private void InitIndex() { IndexClear(); foreach (XmlNode paraXn in m_xmlRoot.ChildNodes) { XmlElement paraXe = (XmlElement)paraXn; ParaIndex paragraph = new ParaIndex(); paragraph.GlobalSentenceStartId = m_listSentences.Count; foreach (XmlNode senXn in paraXe.ChildNodes) { XmlElement senXe = (XmlElement)senXn; SentIndex sentence = new SentIndex(); foreach (XmlNode wordXn in senXe.ChildNodes) { sentence.WordList.Add(new Word((XmlElement)wordXn)); } sentence.XmlElem = senXe; sentence.StrContent = senXe.GetAttribute("cont"); paragraph.SentenceList.Add(sentence); m_listSentences.Add(sentence); } paragraph.XmlElem = paraXe; m_listParas.Add(paragraph); } }
public void SetParagraphNumber(int paragraphNumber) { for (int i = m_listParas.Count; i < paragraphNumber; i++) { XmlNode xmlParaNode = m_xmlDocument.CreateNode(XmlNodeType.Element, "para", ""); XmlAttribute xmlParaAttribute = m_xmlDocument.CreateAttribute("id"); xmlParaAttribute.Value = i.ToString(); xmlParaNode.Attributes.Append(xmlParaAttribute); m_xmlRoot.AppendChild(xmlParaNode); ParaIndex paraIndexCur = new ParaIndex(); paraIndexCur.XmlElem = (XmlElement)xmlParaNode; m_listParas.Add(paraIndexCur); paraIndexCur.GlobalSentenceStartId = m_listSentences.Count; } }
private void InitIndex() { IndexClear(); foreach(XmlNode paraXn in m_xmlRoot.ChildNodes) { XmlElement paraXe = (XmlElement)paraXn; ParaIndex paragraph = new ParaIndex(); paragraph.GlobalSentenceStartId = m_listSentences.Count; foreach(XmlNode senXn in paraXe.ChildNodes) { XmlElement senXe = (XmlElement)senXn; SentIndex sentence = new SentIndex(); foreach(XmlNode wordXn in senXe.ChildNodes) { sentence.WordList.Add(new Word((XmlElement)wordXn)); } sentence.XmlElem = senXe; sentence.StrContent = senXe.GetAttribute("cont"); paragraph.SentenceList.Add(sentence); m_listSentences.Add(sentence); } paragraph.XmlElem = paraXe; m_listParas.Add(paragraph); } }