Fede wrote:
the problem is that i don't want xmlns attribute in my xml neither empty
neither with a value, how can i do?
Well then make sure there is no element in the DOM tree that is in a
namespace. If the serializer does e.g.
xmlns=""
when serializing your DOM tree then that means there is an element in
the DOM tree which is in a namespace.
So somewhere up the tree you have an element in a namespace, if you
don't want that then don't create it at all or remove it before serializing.
For instance with the code
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.AppendChild(xmlDocument.CreateElement( "root"));
xmlDocument.DocumentElement.AppendChild(xmlDocumen t.CreateElement("child"));
xmlDocument.Save(Console.Out);
the result is
<root>
<child />
</root>
so you can see there is no xmlns="" declaration. However if the code is e.g.
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.AppendChild(xmlDocument.CreateElement( "root",
"http://example.com/2006/ns1"));
xmlDocument.DocumentElement.AppendChild(xmlDocumen t.CreateElement("child"));
xmlDocument.Save(Console.Out);
then the result is
<root xmlns="http://example.com/2006/ns1">
<child xmlns="" />
</root>
You can see that the creation of the element with tag name "child" is
the same in both examples, only the serialization differs as the parent
element is in a namespace in the second example. That means you have to
look at the ancestors of the element where you get xmlns="" and make
sure that the ancestor is in no namespace.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/