public void WriteEndElement(bool allowShortcutTag) { if (this.pageParent[this.idxParent].HasContentChild) { if (this.textBldr.HasText) { this.CachedTextNode(); } } else { switch (this.textBldr.TextType) { case TextBlockType.Text: if (this.lineInfo != null) { if (this.textBldr.LineNumber != this.pageParent[this.idxParent].LineNumber) { break; } int posOffset = this.textBldr.LinePosition - this.pageParent[this.idxParent].LinePosition; if ((posOffset < 0) || (posOffset > 0xff)) { break; } this.pageParent[this.idxParent].SetCollapsedLineInfoOffset(posOffset); } this.pageParent[this.idxParent].SetCollapsedValue(this.textBldr.ReadText()); goto Label_0134; case TextBlockType.SignificantWhitespace: case TextBlockType.Whitespace: break; default: this.pageParent[this.idxParent].SetEmptyValue(allowShortcutTag); goto Label_0134; } this.CachedTextNode(); this.pageParent[this.idxParent].SetValue(this.pageSibling[this.idxSibling].Value); } Label_0134: if (this.pageParent[this.idxParent].HasNamespaceDecls) { this.doc.AddNamespace(this.pageParent, this.idxParent, this.pageNmsp, this.idxNmsp); XPathNodeRef ref2 = this.stkNmsp.Pop(); this.pageNmsp = ref2.Page; this.idxNmsp = ref2.Index; } this.pageSibling = this.pageParent; this.idxSibling = this.idxParent; this.idxParent = this.pageParent[this.idxParent].GetParent(out this.pageParent); }
internal int LookupNamespaces(XPathNode[] pageElem, int idxElem, out XPathNode[] pageNmsp) { XPathNodeRef key = new XPathNodeRef(pageElem, idxElem); if ((this.mapNmsp == null) || !this.mapNmsp.ContainsKey(key)) { pageNmsp = null; return 0; } key = this.mapNmsp[key]; pageNmsp = key.Page; return key.Index; }
/// <summary> /// Lookup the namespace nodes associated with an element. /// </summary> internal int LookupNamespaces(XPathNode[] pageElem, int idxElem, out XPathNode[] pageNmsp) { XPathNodeRef nodeRef = new XPathNodeRef(pageElem, idxElem); Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element); // Check whether this element has any local namespaces if (_mapNmsp == null || !_mapNmsp.ContainsKey(nodeRef)) { pageNmsp = null; return 0; } // Yes, so return the page and index of the first local namespace node nodeRef = _mapNmsp[nodeRef]; pageNmsp = nodeRef.Page; return nodeRef.Index; }