/// <summary> /// Returns: /// XmlNodeOrder.Unknown -- This navigator and the "other" navigator are not of the same type, or the /// navigator's are not positioned on nodes in the same document. /// XmlNodeOrder.Before -- This navigator's current node is before the "other" navigator's current node /// in document order. /// XmlNodeOrder.After -- This navigator's current node is after the "other" navigator's current node /// in document order. /// XmlNodeOrder.Same -- This navigator is positioned on the same node as the "other" navigator. /// </summary> public override XmlNodeOrder ComparePosition(XPathNavigator other) { XPathDocumentNavigator that = other as XPathDocumentNavigator; if (that != null) { XPathDocument thisDoc = _pageCurrent[_idxCurrent].Document; XPathDocument thatDoc = that._pageCurrent[that._idxCurrent].Document; if ((object)thisDoc == (object)thatDoc) { int locThis = GetPrimaryLocation(); int locThat = that.GetPrimaryLocation(); if (locThis == locThat) { locThis = GetSecondaryLocation(); locThat = that.GetSecondaryLocation(); if (locThis == locThat) { return(XmlNodeOrder.Same); } } return((locThis < locThat) ? XmlNodeOrder.Before : XmlNodeOrder.After); } } return(XmlNodeOrder.Unknown); }
public override XmlNodeOrder ComparePosition(XPathNavigator other) { XPathDocumentNavigator navigator = other as XPathDocumentNavigator; if (navigator != null) { XPathDocument document = this.pageCurrent[this.idxCurrent].Document; XPathDocument document2 = navigator.pageCurrent[navigator.idxCurrent].Document; if (document == document2) { int primaryLocation = this.GetPrimaryLocation(); int secondaryLocation = navigator.GetPrimaryLocation(); if (primaryLocation == secondaryLocation) { primaryLocation = this.GetSecondaryLocation(); secondaryLocation = navigator.GetSecondaryLocation(); if (primaryLocation == secondaryLocation) { return(XmlNodeOrder.Same); } } if (primaryLocation >= secondaryLocation) { return(XmlNodeOrder.After); } return(XmlNodeOrder.Before); } } return(XmlNodeOrder.Unknown); }