private Book ReadBook(Bible bible, XmlNode node) { Book book = new Book(bible) { Abbreviation = GetAttribute(node, "id"), }; Chapter chapter = null; foreach (XmlNode child in node.ChildNodes) switch (child.Name) { case "h": book.Name = child.InnerText.Trim(); break; case "c": chapter = new Chapter(book) { Number = GetAttributeInt(child, "id"), }; book.Chapters.Add(chapter); break; case "p": ReadParagraph(chapter, child); break; } return book; }
public override Bible HydrateBible() { XmlDocument doc = new XmlDocument(); doc.Load(FILENAME); XmlNode root = doc.ChildNodes[1]; Bible bible = new Bible() { TranslationName = "King James Version" }; foreach (XmlNode child in root.ChildNodes) if (child.Name == "book") { if (GetAttribute(child, "id") == "FRT") { // Ignore the Preface } else bible.Books.Add(ReadBook(bible, child)); } return bible; }
internal Book(Bible bible) { Bible = bible; Chapters = new List<Chapter>(); }