Update of /cvsroot/mvp-xml/Common/v1/src/XPath
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22700/v1/src/XPath
Modified Files:
XPathNavigatorReader.cs
Log Message:
Bug fix in XmlNodeListFactory. Thanks to Raneses, Jason.
Bug fixes in XPathNavigatorReader (thanks Oleg!)
Index: XPathNavigatorReader.cs
===================================================================
RCS file: /cvsroot/mvp-xml/Common/v1/src/XPath/XPathNavigatorReader.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- XPathNavigatorReader.cs 28 Oct 2004 18:20:19 -0000 1.3
+++ XPathNavigatorReader.cs 14 Nov 2004 01:24:29 -0000 1.4
@@ -28,7 +28,7 @@
/// See: http://weblogs.asp.net/cazzu/archive/2004/04/19/115966.aspx and
/// http://weblogs.asp.net/cazzu/archive/2004/05/10/129101.aspx.
/// </remarks>
- public class XPathNavigatorReader : XmlTextReader, IXmlSerializable, IHasXPathNavigator
+ public class XPathNavigatorReader : XmlTextReader, IXmlSerializable, IXPathNavigable
{
#region Fields
@@ -621,13 +621,20 @@
}
// If XML fragment is not allowed and we're already at the
+ // original location, and the were no children, this is an empty root.
+ if (_navigator.IsSamePosition(_original) && !_fragment && !_navigator.HasChildren)
+ {
+ _eof = true;
+ _state = ReadState.EndOfFile;
+ return false;
+ }
+ // If XML fragment is not allowed and we're already at the
// original location, set as end element.
if (_navigator.IsSamePosition(_original) && !_fragment)
{
_isendelement = true;
return true;
}
-
// Otherwise, try to move to sibling.
if (_navigator.MoveToNext())
{
@@ -736,16 +743,16 @@
#endregion
- #region IHasXPathNavigator Members
+ #region IXPathNavigable Members
- /// <summary>
- /// Returns the XPathNavigator for the current position.
- /// </summary>
- public XPathNavigator GetNavigator()
- {
- return _navigator.Clone();
- }
+ /// <summary>
+ /// Returns the XPathNavigator for the current position.
+ /// </summary>
+ public XPathNavigator CreateNavigator()
+ {
+ return _navigator.Clone();
+ }
- #endregion
- }
+ #endregion
+ }
}
|