Пример #1
0
 private void ReadParagraph(Chapter chapter, XmlNode node)
 {
     Verse verse = null;
     bool isNewParagraph = true;
     foreach (XmlNode child in node.ChildNodes)
         switch (child.Name)
         {
             case "v":
                 verse = new Verse(chapter)
                 {
                     Number = GetAttributeInt(child, "id"),
                     IsParagraphStart = isNewParagraph,
                 };
                 chapter.Verses.Add(verse);
                 isNewParagraph = false;
                 break;
             case "w":
                 verse.Words.Add(ReadWord(verse, child));
                 break;
             case "add":
                 verse.Words.Add(ReadWord(verse, child, true));
                 break;
             case "#text":
                 if (verse != null)
                 {
                     verse.Words.Add(ReadWord(verse, child));
                 }
                 break;
             case "ve":
                 // Do nothing... Verse End marker
                 break;
         }
 }
Пример #2
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;
        }
Пример #3
0
 internal Verse(Chapter chapter)
 {
     Chapter = chapter;
     Words = new List<Word>();
 }