Example #1
0
        public override bool IsDescendant(XPathNavigator nav)
        {
            SeekableDTMXPathNavigator2 another = nav as SeekableDTMXPathNavigator2;

            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);
        }
Example #2
0
        public override bool IsSamePosition(XPathNavigator other)
        {
            SeekableDTMXPathNavigator2 another = other as SeekableDTMXPathNavigator2;

            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);
        }
Example #3
0
        // Copy constructor including position informations.
        public SeekableDTMXPathNavigator2(SeekableDTMXPathNavigator2 org)
        {
            document      = org.document;
            currentIsNode = org.currentIsNode;
            currentIsAttr = org.currentIsAttr;

            currentNode = org.currentNode;
            currentAttr = org.currentAttr;
            currentNs   = org.currentNs;
        }
Example #4
0
		// Copy constructor including position informations.
		public SeekableDTMXPathNavigator2 (SeekableDTMXPathNavigator2 org)
		{
			document = org.document;
			currentIsNode = org.currentIsNode;
			currentIsAttr = org.currentIsAttr;

			currentNode = org.currentNode;
			currentAttr = org.currentAttr;
			currentNs = org.currentNs;
		}
Example #5
0
        public override bool MoveTo(XPathNavigator other)
        {
            SeekableDTMXPathNavigator2 another = other as SeekableDTMXPathNavigator2;

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

            this.currentNode   = another.currentNode;
            this.currentAttr   = another.currentAttr;
            this.currentNs     = another.currentNs;
            this.currentIsNode = another.currentIsNode;
            this.currentIsAttr = another.currentIsAttr;
            return(true);
        }
Example #6
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 SeekableDTMXPathNavigator2 (this);
		}
Example #7
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 SeekableDTMXPathNavigator2(this);
        }
Example #8
0
        public override XmlNodeOrder ComparePosition(XPathNavigator nav)
        {
            SeekableDTMXPathNavigator2 another = nav as SeekableDTMXPathNavigator2;

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