void ReadWordParts(XElement wordNode, CorpusVerseWord corpusVerseWord) { var partNodes = wordNode .Element("wordParts") .Elements("wordPart") .ToList(); for (int index = 0; index < partNodes.Count; index++) { XElement currentWordPartNode = partNodes[index]; ReadWordPart(currentWordPartNode, corpusVerseWord, index); } }
void ReadWordPart(XElement wordPartNode, CorpusVerseWord corpusVerseWord, int index) { string typeCode = wordPartNode.Element("type").Value; string root = wordPartNode.Element("root").Value; string[] decorators = wordPartNode .Descendants("decorator") .Select(x => x.Value) .ToArray(); var wordPart = new CorpusVerseWordPart( index: index, typeCode: typeCode, root: root, decorators: decorators ); corpusVerseWord.AddPart(wordPart); }
void ReadVerseWord(XElement wordNode, CorpusVerse corpusVerse, int index) { string buckwalter = wordNode.Element("buckwalter").Value; string english = wordNode.Element("english").Value; var reference = new MultiPartReference( new string[] { corpusVerse.Reference.Chapter.ToString(), corpusVerse.Reference.Verse.ToString(), (index + 1).ToString() } ); var corpusVerseWord = new CorpusVerseWord( index: index + 1, buckwalter: buckwalter, english: english ); corpusVerse.AddWord(corpusVerseWord); ReadWordParts(wordNode, corpusVerseWord); }