2002-12-21 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
[mono.git] / mcs / class / System.XML / System.Xml / XmlElement.cs
index 9af2c4eb1bfdb037c5b14e70ab63960afb016062..46f20cbe7a32c6e8c22206c117381c605b2d6c10 100644 (file)
@@ -358,14 +358,16 @@ namespace System.Xml
                        w.WriteStartElement(Prefix, LocalName, NamespaceURI);
 
                        // write namespace declarations(if not exist)
-                       if(Prefix != null && w.LookupPrefix(Prefix) != NamespaceURI)
+                       if(Prefix != null && Prefix != String.Empty && w.LookupPrefix(Prefix) != NamespaceURI)
                                w.WriteAttributeString("xmlns", Prefix, "http://www.w3.org/2000/xmlns/", NamespaceURI);
 
                        foreach(XmlNode attributeNode in Attributes)
                        {
                                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 != String.Empty &&
+                                  w.LookupPrefix(attributeNode.Prefix) != attributeNode.NamespaceURI &&
+                                  attributeNode.Prefix != "xmlns")
                                        w.WriteAttributeString("xmlns", attributeNode.Prefix, "http://www.w3.org/2000/xmlns/", attributeNode.NamespaceURI);
                        }