public override bool IsSamePosition(XPathNavigator other) { DTMXPathNavigator another = other as DTMXPathNavigator; if (another == null || another.document != this.document) { return(false); } if (this.currentNode != another.currentNode || this.currentIsAttr != another.currentIsAttr || this.currentIsNode != another.currentIsNode) { return(false); } if (currentIsAttr) { return(this.currentAttr == another.currentAttr); } else if (!currentIsNode) { return(this.currentNs == another.currentNs); } return(true); }
public override bool IsDescendant(XPathNavigator nav) { DTMXPathNavigator another = nav as DTMXPathNavigator; if (another == null || another.document != this.document) { return(false); } // Maybe we can improve here more efficiently by // comparing node indices. if (another.currentNode == currentNode) { return(!another.currentIsNode); } int tmp = nodes [another.currentNode].Parent; while (tmp != 0) { if (tmp == currentNode) { return(true); } tmp = nodes [tmp].Parent; } return(false); }
public DTMXPathNavigator(DTMXPathNavigator org) : this(org.document, org.nameTable, org.nodes, org.attributes, org.namespaces, org.idTable) { this.currentIsNode = org.currentIsNode; this.currentIsAttr = org.currentIsAttr; this.currentNode = org.currentNode; this.currentAttr = org.currentAttr; this.currentNs = org.currentNs; }
// Copy constructor including position informations. public DTMXPathNavigator (DTMXPathNavigator org) : this (org.document, org.nameTable, org.nodes, org.attributes, org.namespaces, org.idTable) { currentIsNode = org.currentIsNode; currentIsAttr = org.currentIsAttr; currentNode = org.currentNode; currentAttr = org.currentAttr; currentNs = org.currentNs; }
public override XmlNodeOrder ComparePosition(XPathNavigator nav) { DTMXPathNavigator dtmxpathNavigator = nav as DTMXPathNavigator; if (dtmxpathNavigator == null || dtmxpathNavigator.document != this.document) { return(XmlNodeOrder.Unknown); } if (this.currentNode > dtmxpathNavigator.currentNode) { return(XmlNodeOrder.After); } if (this.currentNode < dtmxpathNavigator.currentNode) { return(XmlNodeOrder.Before); } if (dtmxpathNavigator.currentIsAttr) { if (!this.currentIsAttr) { return(XmlNodeOrder.Before); } if (this.currentAttr > dtmxpathNavigator.currentAttr) { return(XmlNodeOrder.After); } if (this.currentAttr < dtmxpathNavigator.currentAttr) { return(XmlNodeOrder.Before); } return(XmlNodeOrder.Same); } else { if (dtmxpathNavigator.currentIsNode) { return(dtmxpathNavigator.currentIsNode ? XmlNodeOrder.Same : XmlNodeOrder.Before); } if (this.currentIsNode) { return(XmlNodeOrder.Before); } if (this.currentNs > dtmxpathNavigator.currentNs) { return(XmlNodeOrder.After); } if (this.currentNs < dtmxpathNavigator.currentNs) { return(XmlNodeOrder.Before); } return(XmlNodeOrder.Same); } }
public XPathNavigator CreateNavigator () { if (root == null) { root = new DTMXPathNavigator (this, nameTable, nodes, attributes, namespaces, idTable); } return root.Clone (); }
public DTMXPathDocument(XmlNameTable nameTable, DTMXPathLinkedNode [] nodes, DTMXPathAttributeNode [] attributes, DTMXPathNamespaceNode [] namespaces, Hashtable idTable) { root = new DTMXPathNavigator(this, nameTable, nodes, attributes, namespaces, idTable); }
public XPathNavigator CreateNavigator() { if (root == null) { root = new DTMXPathNavigator(this, nameTable, nodes, attributes, namespaces, idTable); } return(root.Clone()); }
public DTMXPathDocument (XmlNameTable nameTable, DTMXPathLinkedNode [] nodes, DTMXPathAttributeNode [] attributes, DTMXPathNamespaceNode [] namespaces, Hashtable idTable) { root = new DTMXPathNavigator (this, nameTable, nodes, attributes, namespaces, idTable); }
public override bool MoveTo(XPathNavigator other) { DTMXPathNavigator dtmxpathNavigator = other as DTMXPathNavigator; if (dtmxpathNavigator == null || dtmxpathNavigator.document != this.document) { return(false); } this.currentNode = dtmxpathNavigator.currentNode; this.currentAttr = dtmxpathNavigator.currentAttr; this.currentNs = dtmxpathNavigator.currentNs; this.currentIsNode = dtmxpathNavigator.currentIsNode; this.currentIsAttr = dtmxpathNavigator.currentIsAttr; return(true); }
public override bool IsSamePosition(XPathNavigator other) { DTMXPathNavigator dtmxpathNavigator = other as DTMXPathNavigator; if (dtmxpathNavigator == null || dtmxpathNavigator.document != this.document) { return(false); } if (this.currentNode != dtmxpathNavigator.currentNode || this.currentIsAttr != dtmxpathNavigator.currentIsAttr || this.currentIsNode != dtmxpathNavigator.currentIsNode) { return(false); } if (this.currentIsAttr) { return(this.currentAttr == dtmxpathNavigator.currentAttr); } return(this.currentIsNode || this.currentNs == dtmxpathNavigator.currentNs); }
public override bool IsDescendant(XPathNavigator nav) { DTMXPathNavigator dtmxpathNavigator = nav as DTMXPathNavigator; if (dtmxpathNavigator == null || dtmxpathNavigator.document != this.document) { return(false); } if (dtmxpathNavigator.currentNode == this.currentNode) { return(!dtmxpathNavigator.currentIsNode); } for (int parent = this.nodes[dtmxpathNavigator.currentNode].Parent; parent != 0; parent = this.nodes[parent].Parent) { if (parent == this.currentNode) { return(true); } } return(false); }
public override XmlNodeOrder ComparePosition(XPathNavigator nav) { DTMXPathNavigator another = nav as DTMXPathNavigator; if (another == null || another.document != this.document) { return(XmlNodeOrder.Unknown); } if (currentNode > another.currentNode) { return(XmlNodeOrder.After); } else if (currentNode < another.currentNode) { return(XmlNodeOrder.Before); } // another may attr or ns, // and this may be also attr or ns. if (another.currentIsAttr) { if (this.currentIsAttr) { if (currentAttr > another.currentAttr) { return(XmlNodeOrder.After); } else if (currentAttr < another.currentAttr) { return(XmlNodeOrder.Before); } else { return(XmlNodeOrder.Same); } } else { return(XmlNodeOrder.Before); } } else if (!another.currentIsNode) { if (!this.currentIsNode) { if (currentNs > another.currentNs) { return(XmlNodeOrder.After); } else if (currentNs < another.currentNs) { return(XmlNodeOrder.Before); } else { return(XmlNodeOrder.Same); } } else { return(XmlNodeOrder.Before); } } else { return(!another.currentIsNode ? XmlNodeOrder.Before : XmlNodeOrder.Same); } }