[Mono-list] Patch for bugzilla 32262 - attributeNode tests in XmlElement.cs

Tim Haynes thaynes@openlinksw.com (Tim Haynes)
Wed, 04 Dec 2002 11:34:45 +0000


--=-=-=

Hi,

Please find attached a patch for XmlElement.cs that fixes the above bug.

Suggested ChangeLog entry:


2002-12-04  Tim Haynes  <thaynes@openlinksw.com>

        * class/System.XML/System.Xml/XmlElement.cs: Made more refined
        checks on attributeNode to fix 32262.


Cheers,

~Tim
-- 
OpenLink Software
Tel: +44 (0) 20 8681 7701
Web: <http://www.openlinksw.com>
Universal Data Access & Data Integration Technology Providers


--=-=-=
Content-Disposition: attachment; filename=b32262-b.diff
Content-Description: fix for bugzilla 32262

Index: class/System.XML/System.Xml/XmlElement.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.XML/System.Xml/XmlElement.cs,v
retrieving revision 1.40
diff -u -r1.40 XmlElement.cs
--- class/System.XML/System.Xml/XmlElement.cs	2 Dec 2002 17:57:45 -0000	1.40
+++ class/System.XML/System.Xml/XmlElement.cs	4 Dec 2002 11:11:29 -0000
@@ -365,7 +365,9 @@
 			{
 				attributeNode.WriteTo(w);
 				// write namespace declarations(if not exist)
-				if(attributeNode.Prefix != null && w.LookupPrefix(attributeNode.Prefix) != attributeNode.NamespaceURI)
+				if(attributeNode.Prefix != null && attributeNode.Prefix != "" &&
+				   w.LookupPrefix(attributeNode.Prefix) != attributeNode.NamespaceURI &&
+				   attributeNode.Prefix != "xmlns")
 					w.WriteAttributeString("xmlns", attributeNode.Prefix, "http://www.w3.org/2000/xmlns/", attributeNode.NamespaceURI);
 			}
 

--=-=-=--