Hi all!
Looks like there's been some regression in System.Xml classes:
Consider the (kind of trivial) code in xmlbug.cs (attached) and test.xml
(also attached)
On .NET it runs ok. On Mono, it produces:
========
Unhandled Exception: System.InvalidOperationException: The requested
operation cannot be performed
in <0x000b1> 00 System.Xml.XmlDocumentNavigator:get_NodeType ()
in <0x00020> 00 System.Xml.XPath.NodeNameTest:Match
(System.Xml.Xsl.XsltContext,System.Xml.XPath.XPathNavigator)
in <0x00034> 00 System.Xml.XPath.AxisIterator:MoveNext ()
in <0x0001a> 00 System.Xml.XPath.SlashIterator:MoveNext ()
in <0x0010e> 00 System.Xml.XmlNode:SelectNodes
(string,System.Xml.XmlNamespaceManager)
in <0x0006d> 00 .Bug1:Main (string[])
========
I found that the problem is related to innocent '<?xml version="1.0" ?>' at
the top of 'test.xml'. If I remove it, everything is OK.
I'm 100% sure that it used to work properly on mono but is broken for some
time now.
Regards,
Jarek
using System;
using System.Xml;
public class Bug1
{
public static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();
doc.Load("test.xml");
foreach (XmlElement el in doc.SelectNodes("xxx/yyy"))
{
Console.WriteLine(el.InnerXml);
}
}
};
<?xml version="1.0" ?>
<xxx>
<yyy>item1</yyy>
<yyy>item2</yyy>
<yyy>item3</yyy>
<yyy>item4</yyy>
</xxx>