示例#1
0
        public override bool IsDescendant(XPathNavigator nav)
        {
            DTMXPathNavigator2 another = nav as DTMXPathNavigator2;

            if (another == null || another.document != this.document)
            {
                return(false);
            }

            if (another.currentNode == currentNode)
            {
                return(!another.currentIsNode);
            }
            int tmp = nodes [another.currentNode].Parent;

            // ancestors must appear in prior on the node list.
            if (tmp < currentNode)
            {
                return(false);
            }

            while (tmp != 0)
            {
                if (tmp == currentNode)
                {
                    return(true);
                }
                tmp = nodes [tmp].Parent;
            }
            return(false);
        }
示例#2
0
        public override bool IsSamePosition(XPathNavigator other)
        {
            DTMXPathNavigator2 another = other as DTMXPathNavigator2;

            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);
        }
示例#3
0
        public override bool IsDescendant(XPathNavigator nav)
        {
            DTMXPathNavigator2 dtmxpathNavigator = nav as DTMXPathNavigator2;

            if (dtmxpathNavigator == null || dtmxpathNavigator.document != this.document)
            {
                return(false);
            }
            if (dtmxpathNavigator.currentNode == this.currentNode)
            {
                return(!dtmxpathNavigator.currentIsNode);
            }
            int parent = this.nodes[dtmxpathNavigator.currentNode].Parent;

            if (parent < this.currentNode)
            {
                return(false);
            }
            while (parent != 0)
            {
                if (parent == this.currentNode)
                {
                    return(true);
                }
                parent = this.nodes[parent].Parent;
            }
            return(false);
        }
示例#4
0
 public DTMXPathNavigator2(DTMXPathNavigator2 org)
 {
     this.document      = org.document;
     this.currentIsNode = org.currentIsNode;
     this.currentIsAttr = org.currentIsAttr;
     this.currentNode   = org.currentNode;
     this.currentAttr   = org.currentAttr;
     this.currentNs     = org.currentNs;
 }
示例#5
0
		// Copy constructor including position informations.
		public DTMXPathNavigator2 (DTMXPathNavigator2 org)
		{
			document = org.document;
			currentIsNode = org.currentIsNode;
			currentIsAttr = org.currentIsAttr;

			currentNode = org.currentNode;
			currentAttr = org.currentAttr;
			currentNs = org.currentNs;
		}
示例#6
0
        public override XmlNodeOrder ComparePosition(XPathNavigator nav)
        {
            DTMXPathNavigator2 dtmxpathNavigator = nav as DTMXPathNavigator2;

            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);
            }
        }
示例#7
0
        public override bool MoveTo(XPathNavigator other)
        {
            DTMXPathNavigator2 dtmxpathNavigator = other as DTMXPathNavigator2;

            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);
        }
示例#8
0
		public DTMXPathDocument2 (XmlNameTable nameTable,
			DTMXPathLinkedNode2 [] nodes,
			DTMXPathAttributeNode2 [] attributes,
			DTMXPathNamespaceNode2 [] namespaces,
			string [] atomicStringPool,
			string [] nonAtomicStringPool,
			Hashtable idTable)
		{
			this.Nodes = nodes;
			this.Attributes = attributes;
			this.Namespaces = namespaces;
			this.AtomicStringPool = atomicStringPool;
			this.NonAtomicStringPool = nonAtomicStringPool;
			this.IdTable = idTable;
			this.NameTable = nameTable;

			root = new DTMXPathNavigator2 (this);
		}
示例#9
0
        public DTMXPathDocument2(XmlNameTable nameTable,
                                 DTMXPathLinkedNode2 [] nodes,
                                 DTMXPathAttributeNode2 [] attributes,
                                 DTMXPathNamespaceNode2 [] namespaces,
                                 string [] atomicStringPool,
                                 string [] nonAtomicStringPool,
                                 Hashtable idTable)
        {
            this.Nodes               = nodes;
            this.Attributes          = attributes;
            this.Namespaces          = namespaces;
            this.AtomicStringPool    = atomicStringPool;
            this.NonAtomicStringPool = nonAtomicStringPool;
            this.IdTable             = idTable;
            this.NameTable           = nameTable;

            root = new DTMXPathNavigator2(this);
        }
示例#10
0
        public override bool IsSamePosition(XPathNavigator other)
        {
            DTMXPathNavigator2 dtmxpathNavigator = other as DTMXPathNavigator2;

            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);
        }
示例#11
0
        public override XmlNodeOrder ComparePosition(XPathNavigator nav)
        {
            DTMXPathNavigator2 another = nav as DTMXPathNavigator2;

            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);
            }
        }