[Mono-list] System.Xml bug
Piers Haken
piersh@friskit.com
Sat, 26 Oct 2002 15:39:24 -0700
This is a multi-part message in MIME format.
------_=_NextPart_001_01C27D40.88ED74FC
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
It looks like XmlDocumentNavigator wasn't handling the xml declaration
node correctly. I have checked the following simple patch into cvs:
Index: XmlDocumentNavigator.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file:
/cvs/public/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs,v
retrieving revision 1.4
diff -u -r1.4 XmlDocumentNavigator.cs
--- XmlDocumentNavigator.cs 13 Sep 2002 02:15:40 -0000 1.4
+++ XmlDocumentNavigator.cs 26 Oct 2002 22:25:28 -0000
@@ -123,7 +123,7 @@
case XmlNodeType.ProcessingInstruction:
return
XPathNodeType.ProcessingInstruction;
}
- throw new InvalidOperationException ();
+ return (XPathNodeType) (-1);
}
}
=20
Piers.
> -----Original Message-----
> From: Jaroslaw Kowalski [mailto:jarek@atm.com.pl]=20
> Sent: Saturday, October 26, 2002 2:11 PM
> To: mono-list@ximian.com
> Subject: [Mono-list] System.Xml bug
>=20
>=20
> Hi all!
>=20
> Looks like there's been some regression in System.Xml=20
> classes: Consider the (kind of trivial) code in xmlbug.cs=20
> (attached) and test.xml (also attached)
>=20
> On .NET it runs ok. On Mono, it produces:
> =3D=3D=3D=3D=3D=3D=3D=3D
> Unhandled Exception: System.InvalidOperationException: The=20
> requested operation cannot be performed in <0x000b1> 00=20
> System.Xml.XmlDocumentNavigator:get_NodeType () in <0x00020>=20
> 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[])
> =3D=3D=3D=3D=3D=3D=3D=3D
>=20
> I found that the problem is related to innocent '<?xml=20
> version=3D"1.0" ?>' at the top of 'test.xml'. If I remove it,=20
> everything is OK. I'm 100% sure that it used to work properly=20
> on mono but is broken for some time now.
>=20
> Regards,
>=20
> Jarek
>=20
------_=_NextPart_001_01C27D40.88ED74FC
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.4417.0">
<TITLE>RE: [Mono-list] System.Xml bug</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=3D2>It looks like XmlDocumentNavigator wasn't handling the =
xml declaration node correctly. I have checked the following simple =
patch into cvs:</FONT></P>
<P><FONT SIZE=3D2>Index: XmlDocumentNavigator.cs</FONT>
<BR><FONT =
SIZE=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT>
<BR><FONT SIZE=3D2>RCS file: =
/cvs/public/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs,v</FO=
NT>
<BR><FONT SIZE=3D2>retrieving revision 1.4</FONT>
<BR><FONT SIZE=3D2>diff -u -r1.4 XmlDocumentNavigator.cs</FONT>
<BR><FONT SIZE=3D2>--- XmlDocumentNavigator.cs =
13 Sep 2002 02:15:40 -0000 1.4</FONT>
<BR><FONT SIZE=3D2>+++ XmlDocumentNavigator.cs =
26 Oct 2002 22:25:28 -0000</FONT>
<BR><FONT SIZE=3D2>@@ -123,7 +123,7 @@</FONT>
<BR><FONT SIZE=3D2> =
=
=
case =
XmlNodeType.ProcessingInstruction:</FONT>
<BR><FONT SIZE=3D2> =
=
=
=
return =
XPathNodeType.ProcessingInstruction;</FONT>
<BR><FONT SIZE=3D2> =
=
=
}</FONT>
<BR><FONT SIZE=3D2>- =
=
=
throw new =
InvalidOperationException ();</FONT>
<BR><FONT SIZE=3D2>+ =
=
=
return (XPathNodeType) =
(-1);</FONT>
<BR><FONT SIZE=3D2> =
=
}</FONT>
<BR><FONT SIZE=3D2> =
}</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>
<P><FONT SIZE=3D2>Piers.</FONT>
</P>
<P><FONT SIZE=3D2>> -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> From: Jaroslaw Kowalski [<A =
HREF=3D"mailto:jarek@atm.com.pl">mailto:jarek@atm.com.pl</A>] </FONT>
<BR><FONT SIZE=3D2>> Sent: Saturday, October 26, 2002 2:11 PM</FONT>
<BR><FONT SIZE=3D2>> To: mono-list@ximian.com</FONT>
<BR><FONT SIZE=3D2>> Subject: [Mono-list] System.Xml bug</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Hi all!</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Looks like there's been some regression in =
System.Xml </FONT>
<BR><FONT SIZE=3D2>> classes: Consider the (kind of trivial) code in =
xmlbug.cs </FONT>
<BR><FONT SIZE=3D2>> (attached) and test.xml (also attached)</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> On .NET it runs ok. On Mono, it produces:</FONT>
<BR><FONT SIZE=3D2>> =3D=3D=3D=3D=3D=3D=3D=3D</FONT>
<BR><FONT SIZE=3D2>> Unhandled Exception: =
System.InvalidOperationException: The </FONT>
<BR><FONT SIZE=3D2>> requested operation cannot be performed in =
<0x000b1> 00 </FONT>
<BR><FONT SIZE=3D2>> System.Xml.XmlDocumentNavigator:get_NodeType () =
in <0x00020> </FONT>
<BR><FONT SIZE=3D2>> 00 System.Xml.XPath.NodeNameTest:Match</FONT>
<BR><FONT SIZE=3D2>> =
(System.Xml.Xsl.XsltContext,System.Xml.XPath.XPathNavigator)</FONT>
<BR><FONT SIZE=3D2>> in <0x00034> 00 =
System.Xml.XPath.AxisIterator:MoveNext ()</FONT>
<BR><FONT SIZE=3D2>> in <0x0001a> 00 =
System.Xml.XPath.SlashIterator:MoveNext ()</FONT>
<BR><FONT SIZE=3D2>> in <0x0010e> 00 =
System.Xml.XmlNode:SelectNodes</FONT>
<BR><FONT SIZE=3D2>> (string,System.Xml.XmlNamespaceManager)</FONT>
<BR><FONT SIZE=3D2>> in <0x0006d> 00 .Bug1:Main =
(string[])</FONT>
<BR><FONT SIZE=3D2>> =3D=3D=3D=3D=3D=3D=3D=3D</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I found that the problem is related to innocent =
'<?xml </FONT>
<BR><FONT SIZE=3D2>> version=3D"1.0" ?>' at the top of =
'test.xml'. If I remove it, </FONT>
<BR><FONT SIZE=3D2>> everything is OK. I'm 100% sure that it used to =
work properly </FONT>
<BR><FONT SIZE=3D2>> on mono but is broken for some time now.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Regards,</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Jarek</FONT>
<BR><FONT SIZE=3D2>> </FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C27D40.88ED74FC--