コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
ファイル: Book.cs プロジェクト: bartekmi/BibleReader
 internal Book(Bible bible)
 {
     Bible = bible;
     Chapters = new List<Chapter>();
 }