dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Xml/Private/XmlDocum...


From: Gopal.V
Subject: [dotgnu-pnet-commits] pnetlib ./ChangeLog System.Xml/Private/XmlDocum...
Date: Sat, 04 Mar 2006 13:46:56 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnetlib
Branch:         
Changes by:     Gopal.V <address@hidden>        06/03/04 13:46:55

Modified files:
        .              : ChangeLog 
        System.Xml/Private: XmlDocumentNavigator.cs 
        System.Xml/XPath/Private: XPathEvaluate.tc 
                                  XPathExpressionBase.cs 
                                  XPathIterators.cs XPathTokenizer.cs 
        System.Xml/XPath: XPathNavigator.cs 

Log message:
        XPath fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/ChangeLog.diff?tr1=1.2363&tr2=1.2364&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Xml/Private/XmlDocumentNavigator.cs.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Xml/XPath/Private/XPathEvaluate.tc.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Xml/XPath/Private/XPathExpressionBase.cs.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Xml/XPath/Private/XPathIterators.cs.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Xml/XPath/Private/XPathTokenizer.cs.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Xml/XPath/XPathNavigator.cs.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: pnetlib/ChangeLog
diff -u pnetlib/ChangeLog:1.2363 pnetlib/ChangeLog:1.2364
--- pnetlib/ChangeLog:1.2363    Mon Feb 27 06:56:43 2006
+++ pnetlib/ChangeLog   Sat Mar  4 13:46:55 2006
@@ -1,4 +1,15 @@
 
+2006-03-04  Gopal V  <address@hidden>
+
+       * System.Xml/Private/XmlDocumentNavigator.cs,
+       System.Xml/XPath/Private/XPathEvaluate.tc,
+       System.Xml/XPath/Private/XPathExpressionBase.cs,
+       System.Xml/XPath/Private/XPathIterators.cs,
+       System.Xml/XPath/Private/XPathTokenizer.cs,
+       System.Xml/XPath/XPathNavigator.cs: Implement
+       more iterators, fix up namespaces and partially
+       implement namespaces in document navigator.
+
 2006-02-27  Gopal V  <address@hidden>
 
        * System.Xml/XmlNodeReader.cs: Implement most of 
Index: pnetlib/System.Xml/Private/XmlDocumentNavigator.cs
diff -u pnetlib/System.Xml/Private/XmlDocumentNavigator.cs:1.8 
pnetlib/System.Xml/Private/XmlDocumentNavigator.cs:1.9
--- pnetlib/System.Xml/Private/XmlDocumentNavigator.cs:1.8      Tue Feb 22 
11:21:22 2005
+++ pnetlib/System.Xml/Private/XmlDocumentNavigator.cs  Sat Mar  4 13:46:55 2006
@@ -32,6 +32,7 @@
 internal class XmlDocumentNavigator : XPathNavigator, IHasXmlNode
 {
        private XmlNode node;
+       private XmlAttribute nsAttr = null;
        private XmlDocument document;
 
        public XmlDocumentNavigator(XmlNode node) : base()
@@ -43,8 +44,7 @@
 
        public XmlDocumentNavigator(XmlDocumentNavigator copy)
        {
-               this.node = copy.node;
-               this.document = copy.document;
+               this.MoveTo(copy);
        }
 
        public override XPathNavigator Clone()
@@ -72,7 +72,7 @@
        public override bool IsSamePosition(XPathNavigator other)
        {
                XmlDocumentNavigator nav = (other as XmlDocumentNavigator);
-               return ((nav != null) && (nav.node == node));
+               return ((nav != null) && (nav.node == node) && (nav.nsAttr == 
nsAttr));
        }
        
        public override bool MoveTo(XPathNavigator other)
@@ -81,6 +81,7 @@
                if(nav != null)
                {
                        node = nav.node;
+                       nsAttr = nav.nsAttr;
                        document = nav.document;
                        return true;
                }
@@ -98,6 +99,7 @@
                                        attr.NamespaceURI == namespaceURI)
                                {
                                        node = attr;
+                                       NamespaceAttribute = null;
                                        return true;
                                }
                        }
@@ -120,10 +122,14 @@
        {
                if(NodeType == XPathNodeType.Element && node.Attributes != null)
                {
-                       if(node.Attributes.Count != 0)
+                       foreach(XmlAttribute attr in node.Attributes)
                        {
-                               node = node.Attributes[0];
-                               return true;
+                               if(attr.NamespaceURI != XmlDocument.xmlns)
+                               {
+                                       node = attr;
+                                       NamespaceAttribute = null;
+                                       return true;
+                               }
                        }
                }
                return false;
@@ -131,6 +137,11 @@
 
        public override bool MoveToFirstChild()
        {
+               if(!HasChildren)
+               {
+                       return false;
+               }
+
                XmlNode next = node.FirstChild;
                // TODO: implement normalization
                while(next!= null && 
@@ -151,6 +162,38 @@
 
        public override bool MoveToFirstNamespace(XPathNamespaceScope 
namespaceScope)
        {
+               if(NodeType != XPathNodeType.Element)
+               {
+                       return false;
+               }
+
+               XmlElement element = (XmlElement)node;
+               while(element != null)
+               {
+                       if(element.Attributes != null)
+                       {
+                               foreach(XmlAttribute attr in element.Attributes)
+                               {
+                                       Console.WriteLine(attr.NamespaceURI);
+                                       if(attr.NamespaceURI == 
XmlDocument.xmlns)
+                                       {
+                                               NamespaceAttribute = attr;
+                                               return true;
+                                       }
+                               }
+                       }
+                       if(namespaceScope == XPathNamespaceScope.Local)
+                       {
+                               return false;
+                       }
+
+                       element = element.ParentNode as XmlElement;
+               }
+
+               if(namespaceScope == XPathNamespaceScope.All)
+               {
+                       // TODO
+               }
                return false;
        }
 
@@ -161,11 +204,38 @@
 
        public override bool MoveToNamespace(String name)
        {
+               if(NodeType != XPathNodeType.Element)
+               {
+                       return false;
+               }
+
+               XmlElement element = (XmlElement)node;
+               while(element != null)
+               {
+                       if(element.Attributes != null)
+                       {
+                               foreach(XmlAttribute attr in element.Attributes)
+                               {
+                                       if(attr.NamespaceURI == 
XmlDocument.xmlns)
+                                       {
+                                               NamespaceAttribute = attr;
+                                               return true;
+                                       }
+                               }
+                       }
+                       element = element.ParentNode as XmlElement;
+               }
+
                return false;
        }
 
        public override bool MoveToNext()
        {
+               if(nsAttr != null)
+               {
+                       return false;
+               }
+
                XmlNode next = node.NextSibling;
                // TODO: implement normalization
                while(next!= null && 
@@ -217,6 +287,7 @@
                        if(i != list.Count)
                        {
                                node = list[i];
+                               NamespaceAttribute = null;
                                return true;
                        }
                }
@@ -225,24 +296,69 @@
 
        public override bool MoveToNextNamespace(XPathNamespaceScope 
namespaceScope)
        {
+               if(nsAttr == null)
+               {
+                       return false;
+               }
+               
+               XmlElement owner = nsAttr.OwnerElement;
+               
+               if(owner == null) 
+               {
+                       return false;
+               }
+
+               for(int i = 0; i < owner.Attributes.Count; i++)
+               {
+                       XmlAttribute attr = owner.Attributes[i];
+                       if(attr == nsAttr)
+                       {
+                               for(int j = 0; j < owner.Attributes.Count; j++)
+                               {
+                                       if(owner.Attributes[j].NamespaceURI == 
+                                                       XmlDocument.xmlns)
+                                       {
+                                               NamespaceAttribute = 
owner.Attributes[j];       
+                                       }
+                               }
+                       }
+               }
+
+               if(namespaceScope == XPathNamespaceScope.Local)
+               {
+                       // TODO: 
+               }
+               
+               if(namespaceScope == XPathNamespaceScope.All)
+               {
+                       // TODO:
+               }
                return false;
        }
        
 
        public override bool MoveToParent()
        {
+               if(nsAttr != null)
+               {
+                       NamespaceAttribute = null;
+                       return true;
+               }
+
                if(node.NodeType == XmlNodeType.Attribute)
                {
                        XmlElement owner = ((XmlAttribute)node).OwnerElement;
                        if(owner != null)
                        {
                                node = owner;
+                               NamespaceAttribute = null;
                                return true;
                        }
                }
                else if (node.ParentNode != null)
                {
                        node = node.ParentNode;
+                       NamespaceAttribute = null;
                        return true;
                }
                return false;
@@ -250,6 +366,11 @@
 
        public override bool MoveToPrevious()
        {
+               if(nsAttr != null)
+               {
+                       return true;
+               }
+
                if(node.PreviousSibling != null)
                {
                        node = node.PreviousSibling;
@@ -265,6 +386,7 @@
                {
                        node = document;
                }
+               NamespaceAttribute = null;
                return;
        }
        
@@ -280,7 +402,7 @@
        {
                get
                {
-                       if(node.Attributes != null)
+                       if(nsAttr == null && node.Attributes != null)
                        {
                                return (node.Attributes.Count != 0);
                        }
@@ -292,7 +414,7 @@
        {
                get
                {
-                       return (node.FirstChild != null);       
+                       return (nsAttr == null && node.FirstChild != null);     
                }
        }
 
@@ -300,7 +422,7 @@
        {
                get
                {
-                       if(node.NodeType == XmlNodeType.Element)
+                       if(nsAttr == null && node.NodeType == 
XmlNodeType.Element)
                        {
                                return ((XmlElement)node).IsEmpty;
                        }
@@ -316,11 +438,14 @@
                        
                        if(nodeType == XPathNodeType.Element ||
                                nodeType == XPathNodeType.Attribute ||
-                               nodeType == XPathNodeType.ProcessingInstruction 
||
-                               nodeType == XPathNodeType.Namespace)
+                               nodeType == XPathNodeType.ProcessingInstruction)
                        {
                                return node.LocalName;
                        }
+                       else if(nodeType == XPathNodeType.Namespace)
+                       {
+                               return nsAttr.LocalName;
+                       }
                        return String.Empty;
                }
        }
@@ -333,11 +458,14 @@
                        
                        if(nodeType == XPathNodeType.Element ||
                                nodeType == XPathNodeType.Attribute ||
-                               nodeType == XPathNodeType.ProcessingInstruction 
||
-                               nodeType == XPathNodeType.Namespace)
+                               nodeType == XPathNodeType.ProcessingInstruction)
                        {
                                return node.Name;
                        }
+                       else if(nodeType == XPathNodeType.Namespace)
+                       {
+                               return LocalName;
+                       }
                        return String.Empty;
                }
        }
@@ -354,6 +482,10 @@
        {
                get
                {
+                       if(nsAttr != null) 
+                       {
+                               return String.Empty;
+                       }
                        return node.NamespaceURI;
                }
        }
@@ -362,6 +494,11 @@
        {
                get
                {
+                       if(nsAttr != null)
+                       {
+                               return XPathNodeType.Namespace;
+                       }
+
                        switch(node.NodeType)
                        {
                                case XmlNodeType.Element:
@@ -449,8 +586,7 @@
                                break;
                                case XPathNodeType.Namespace:
                                {
-                                       // TODO ?
-                                       return String.Empty;
+                                       return nsAttr.Value; 
                                }
                                break;
                        }
@@ -475,13 +611,30 @@
        {
                get
                {
+                       if(this.nsAttr != null) 
+                       {
+                               return this.nsAttr;
+                       }
                        return this.node;
                }
        }
 
+       internal XmlAttribute NamespaceAttribute 
+       {
+               get
+               {
+                       return this.nsAttr;
+               }
+               set
+               {
+                       /* TODO: keep track of all available ns values */
+                       this.nsAttr = value;
+               }
+       }
+
        XmlNode IHasXmlNode.GetNode()
        {
-               return this.node;
+               return CurrentNode;
        }
 }
 
Index: pnetlib/System.Xml/XPath/Private/XPathEvaluate.tc
diff -u pnetlib/System.Xml/XPath/Private/XPathEvaluate.tc:1.7 
pnetlib/System.Xml/XPath/Private/XPathEvaluate.tc:1.8
--- pnetlib/System.Xml/XPath/Private/XPathEvaluate.tc:1.7       Fri Dec 10 
17:28:33 2004
+++ pnetlib/System.Xml/XPath/Private/XPathEvaluate.tc   Sat Mar  4 13:46:55 2006
@@ -29,7 +29,7 @@
 {
        XPathNavigator nav = iterator.Current.Clone();
        nav.MoveToRoot();
-       return new XPathSelfIterator(nav, null);
+       return new XPathSelfIterator(nav, this.NamespaceManager);
 }
 
 EvaluateInternal(NodeTest)
@@ -94,6 +94,41 @@
                                                                        
(XPathBaseIterator)iterator);
                }
                break;
+
+               case XPathAxis.Following:
+               {
+                       axis = new XPathFollowingIterator(
+                                                                       
(XPathBaseIterator)iterator);
+               }
+               break;
+
+               case XPathAxis.FollowingSibling:
+               {
+                       axis = new XPathFollowingSiblingIterator(
+                                                                       
(XPathBaseIterator)iterator);
+               }
+               break;
+               
+               case XPathAxis.Preceding:
+               {
+                       axis = new XPathPrecedingIterator(
+                                                                       
(XPathBaseIterator)iterator);
+               }
+               break;
+               
+               case XPathAxis.PrecedingSibling:
+               {
+                       axis = new XPathPrecedingSiblingIterator(
+                                                                       
(XPathBaseIterator)iterator);
+               }
+               break;
+
+               case XPathAxis.Namespace:
+               {
+                       axis = new XPathNamespaceIterator(
+                                                                       
(XPathBaseIterator)iterator);
+               }
+               break;
                
                default:
                {
Index: pnetlib/System.Xml/XPath/Private/XPathExpressionBase.cs
diff -u pnetlib/System.Xml/XPath/Private/XPathExpressionBase.cs:1.5 
pnetlib/System.Xml/XPath/Private/XPathExpressionBase.cs:1.6
--- pnetlib/System.Xml/XPath/Private/XPathExpressionBase.cs:1.5 Tue Feb 22 
11:21:22 2005
+++ pnetlib/System.Xml/XPath/Private/XPathExpressionBase.cs     Sat Mar  4 
13:46:55 2006
@@ -30,6 +30,8 @@
 
 internal abstract class XPathExpressionBase : XPathExpression
 {
+       private XmlNamespaceManager nsManager = null;
+
        private XPathResultType resultType = XPathResultType.Error;
 
        public override void AddSort(Object expr, IComparer comparer){}
@@ -43,7 +45,10 @@
                return null; 
        }
 
-       public override void SetContext(XmlNamespaceManager nsManager){}
+       public override void SetContext(XmlNamespaceManager nsManager)
+       {
+               this.nsManager = nsManager;
+       }
 
        public override String Expression
        {
@@ -79,6 +84,14 @@
                }
        }
 
+       protected XmlNamespaceManager NamespaceManager 
+       {
+               get
+               {
+                       return this.nsManager;
+               }
+       }
+
        internal Object Evaluate(XPathNodeIterator iterator)
        {
                if(this is Expression)
Index: pnetlib/System.Xml/XPath/Private/XPathIterators.cs
diff -u pnetlib/System.Xml/XPath/Private/XPathIterators.cs:1.7 
pnetlib/System.Xml/XPath/Private/XPathIterators.cs:1.8
--- pnetlib/System.Xml/XPath/Private/XPathIterators.cs:1.7      Tue Feb 22 
11:21:22 2005
+++ pnetlib/System.Xml/XPath/Private/XPathIterators.cs  Sat Mar  4 13:46:55 2006
@@ -30,12 +30,17 @@
        internal abstract class XPathBaseIterator : XPathNodeIterator
        {
                private int count = -1;
+               /* reference hell :) */
+               private XmlNamespaceManager nsManager;
+
                public XPathBaseIterator (XPathBaseIterator parent)
                {
+                       this.nsManager = parent.nsManager;
                }
                
                public XPathBaseIterator (XmlNamespaceManager nsmanager)
                {
+                       this.nsManager = nsManager;
                }
 
                public override int Count
@@ -57,6 +62,13 @@
                        }
                }
 
+               public XmlNamespaceManager NamespaceManager
+               {
+                       get
+                       {
+                               return this.nsManager;
+                       }
+               }
        }
 
        internal abstract class XPathSimpleIterator : XPathBaseIterator
@@ -460,6 +472,257 @@
                }
        }
 
+       internal class XPathPrecedingIterator : XPathSimpleIterator
+       {
+               private bool finished = false; 
+               private XPathNavigator start = null;
+               
+               public XPathPrecedingIterator (XPathBaseIterator iterator) : 
base (iterator)
+               {
+                       /* remember where we started from and go up the tree */
+                       start = iterator.Current.Clone();
+                       this.navigator.MoveToRoot();
+               }
+
+               public XPathPrecedingIterator(XPathPrecedingIterator copy) : 
base (copy)
+               {
+                       this.finished = copy.finished;
+                       this.start = copy.start;
+               }
+
+               public override XPathNodeIterator Clone()
+               {
+                       return new XPathPrecedingIterator(this);
+               }
+
+               public override bool MoveNext()
+               {
+                       if(finished) 
+                       {
+                               return false;
+                       }
+                       
+                       /* the lesson seems to be that you really
+                          mean ::preceding-sibling half the time
+                          you say ::preceding. This is expensive
+                          as hell !!! */
+                       do
+                       {
+                               while(!navigator.MoveToFirstChild())
+                               {
+                                       /* every sibling is traversed before 
any child */
+                                       while(!navigator.MoveToNext())
+                                       {
+                                               if(!navigator.MoveToParent())
+                                               {
+                                                       /* we hit the root node 
*/
+                                                       finished = true;
+                                                       return false;
+                                               }
+                                       }
+                               }
+                       }
+                       while(navigator.IsDescendant(start));
+
+                       /* start is not a descendant of current node */
+                       if(navigator.ComparePosition(this.start) == 
XmlNodeOrder.Before)
+                       {
+                               pos++;
+                               current = navigator.Clone();    
+                               return true;
+                       }
+                       
+                       finished = true;
+                       return false;
+               }
+       }
+
+       internal class XPathPrecedingSiblingIterator : XPathSimpleIterator
+       {
+               private bool finished = false; 
+               private bool started = false;
+               private XPathNavigator start = null;
+               
+               public XPathPrecedingSiblingIterator (XPathBaseIterator 
iterator) 
+                       : base (iterator)
+               {
+                       start = iterator.Current.Clone();
+                       if(start.NodeType == XPathNodeType.Attribute ||
+                               start.NodeType == XPathNodeType.Namespace)
+                       {
+                               finished = true;
+                       }
+                       navigator.MoveToFirst();
+               }
+
+               public 
XPathPrecedingSiblingIterator(XPathPrecedingSiblingIterator copy)
+                       : base (copy)
+               {
+                       this.finished = copy.finished;
+                       this.started = copy.started;
+                       this.start = copy.start;
+               }
+
+               public override XPathNodeIterator Clone()
+               {
+                       return new XPathPrecedingSiblingIterator(this);
+               }
+
+               public override bool MoveNext()
+               {
+                       if(finished) 
+                       {
+                               return false;
+                       }
+
+                       if((!started) || navigator.MoveToNext())
+                       {
+                               started = true;
+                               if(navigator.ComparePosition(start) == 
XmlNodeOrder.Before)
+                               {
+                                       pos++;
+                                       current = navigator.Clone();
+                                       return true;
+                               }
+                       }
+
+                       /* the code will never again  reach this line 
+                          thanks to the first if(finished)
+                          started = true; 
+                       */
+                       finished = true;
+                       return false;
+               }
+       }
+
+       internal class XPathFollowingIterator : XPathSimpleIterator
+       {
+               private bool finished = false; 
+               
+               public XPathFollowingIterator (XPathBaseIterator iterator) : 
base (iterator)
+               {
+               }
+
+               public XPathFollowingIterator(XPathFollowingIterator copy) : 
base (copy)
+               {
+                       this.finished = copy.finished;
+               }
+
+               public override XPathNodeIterator Clone()
+               {
+                       return new XPathFollowingIterator(this);
+               }
+
+               public override bool MoveNext()
+               {
+                       // This is needed as at the end of the loop, the 
original 
+                       // will be restored as the navigator value.
+                       if(finished) 
+                       {
+                               return false;
+                       }
+                       bool movedToParent = false;
+
+                       if(this.pos == 0)
+                       {
+                               if(navigator.NodeType == 
XPathNodeType.Attribute ||
+                                       navigator.NodeType == 
XPathNodeType.Namespace)
+                               {
+                                       /* this is almost always true ? */
+                                       movedToParent = 
navigator.MoveToParent();
+                               }
+                       }
+
+                       if(this.pos != 0 || movedToParent)
+                       {
+                               if(navigator.MoveToFirstChild())
+                               {
+                                       pos++;
+                                       current = navigator.Clone();
+                                       return true;
+                               }
+                       }
+
+                       do 
+                       {
+                               if(navigator.MoveToNext())
+                               {
+                                       pos++;
+                                       current = navigator.Clone();
+                                       return true;
+                               }
+                       }
+                       while(navigator.MoveToParent());
+
+                       finished = true;
+                       return false;
+               }
+       }
+
+       internal class XPathFollowingSiblingIterator : XPathSimpleIterator
+       {
+               public XPathFollowingSiblingIterator (XPathBaseIterator 
iterator) 
+                       : base (iterator)
+               {
+               }
+
+               public 
XPathFollowingSiblingIterator(XPathFollowingSiblingIterator copy)
+                       : base (copy)
+               {
+               }
+
+               public override XPathNodeIterator Clone()
+               {
+                       return new XPathFollowingSiblingIterator(this);
+               }
+
+               public override bool MoveNext()
+               {
+                       if(navigator.NodeType == XPathNodeType.Attribute ||
+                               navigator.NodeType == XPathNodeType.Namespace)
+                       {
+                               /* nodemaps not siblings */
+                               return false;
+                       }
+                       if(navigator.MoveToNext())
+                       {
+                               pos++;
+                               current = navigator.Clone();
+                               return true;
+                       }
+                       return false;
+               }
+       }
+       
+       internal class XPathNamespaceIterator : XPathSimpleIterator
+       {
+               public XPathNamespaceIterator (XPathBaseIterator iterator) 
+                       : base (iterator)
+               {
+               }
+
+               public XPathNamespaceIterator(XPathNamespaceIterator copy)
+                       : base (copy)
+               {
+               }
+
+               public override XPathNodeIterator Clone()
+               {
+                       return new XPathNamespaceIterator(this);
+               }
+
+               public override bool MoveNext()
+               {
+                       if((pos == 0 && navigator.MoveToFirstNamespace()) ||
+                               navigator.MoveToNextNamespace())
+                       {
+                               pos++;
+                               current = navigator.Clone();
+                               return true;
+                       }
+                       return false;
+               }
+       }
 
        internal class XPathAxisIterator : XPathBaseIterator
        {
@@ -467,7 +730,8 @@
                protected NodeTest test;
                protected int pos;
 
-               public XPathAxisIterator(XPathSimpleIterator iterator, NodeTest 
test)
+               public XPathAxisIterator(XPathSimpleIterator iterator, 
+                                                                       
NodeTest test)
                        : base(iterator)
                {
                        this.iterator = iterator;
@@ -491,11 +755,16 @@
                {
                        String name = null; 
                        String ns = null;
+                       String nsURI = null;
                        
                        if(test.name != null)
                        {
                                name = test.name.Name;
                                ns = test.name.Namespace;
+                               if(ns != null && this.NamespaceManager != null)
+                               {
+                                       nsURI = 
this.NamespaceManager.LookupNamespace(ns);
+                               }
                        }
                        while(iterator.MoveNext())
                        {
@@ -504,8 +773,7 @@
                                {
                                        continue;
                                }
-                               // TODO: namespace lookups using namespace 
manager
-                               if(ns != null && Current.NamespaceURI != ns)
+                               if(nsURI != null && Current.NamespaceURI != 
nsURI)
                                {
                                        continue;
                                }
Index: pnetlib/System.Xml/XPath/Private/XPathTokenizer.cs
diff -u pnetlib/System.Xml/XPath/Private/XPathTokenizer.cs:1.10 
pnetlib/System.Xml/XPath/Private/XPathTokenizer.cs:1.11
--- pnetlib/System.Xml/XPath/Private/XPathTokenizer.cs:1.10     Tue Oct 18 
12:15:33 2005
+++ pnetlib/System.Xml/XPath/Private/XPathTokenizer.cs  Sat Mar  4 13:46:55 2006
@@ -496,8 +496,6 @@
                                {
                                        String ns=sb.ToString();
                                        sb = new StringBuilder();
-                                       
-                                       sb.Append(':');
                                        do
                                        {
                                                Assert(Read() == ch);
@@ -505,12 +503,12 @@
                                                ch = Peek();
                                        }while(Char.IsLetter((Char)ch) || 
Char.IsDigit((Char)ch)
                                                        || ch == '_');
-                                       Value = new XmlQualifiedName(ns, 
sb.ToString());
+                                       Value = new 
XmlQualifiedName(sb.ToString(), ns);
                                        return Token.QNAME;
                                }
                                else if(ch == '*')
                                {
-                                       Value = new 
XmlQualifiedName(sb.ToString(),"*");
+                                       Value = new XmlQualifiedName("*", 
sb.ToString());
                                        return Token.WILDCARDNAME;
                                }
                                else
Index: pnetlib/System.Xml/XPath/XPathNavigator.cs
diff -u pnetlib/System.Xml/XPath/XPathNavigator.cs:1.7 
pnetlib/System.Xml/XPath/XPathNavigator.cs:1.8
--- pnetlib/System.Xml/XPath/XPathNavigator.cs:1.7      Tue Feb 22 11:21:22 2005
+++ pnetlib/System.Xml/XPath/XPathNavigator.cs  Sat Mar  4 13:46:55 2006
@@ -120,10 +120,9 @@
 
        public abstract bool MoveToFirstChild();
 
-       [TODO]
        public bool MoveToFirstNamespace()
                        {
-                                throw new 
NotImplementedException("MoveToFirstNamespace");
+                               return 
MoveToFirstNamespace(XPathNamespaceScope.All);
                        }
 
        public abstract bool MoveToFirstNamespace(
@@ -137,10 +136,9 @@
 
        public abstract bool MoveToNextAttribute();
 
-       [TODO]
        public bool MoveToNextNamespace()
                        {
-                                throw new 
NotImplementedException("MoveToNextNamespace");
+                               return 
MoveToFirstNamespace(XPathNamespaceScope.All);
                        }
 
        public abstract bool MoveToNextNamespace(XPathNamespaceScope 
namespaceScope);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]