Blank namespace using .NET DOM

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
Im getting some problems in an xml elaboration using .NET 2.0 DOM. What Im tring to do is insert a node in an already existing xml tree; the xml root contains definition of namespaces, but when I add my new node I dont want any namespace definition on
it (so I dont define any namespace on the newly created node). The problem is that when I add the node (using appendchild method) .NET DOM adds a blank namespace definition on it, and this is a problem for me (cause I need to validate the xml tree to a schema
definition).
The code I use to create the node is: System.Xml.XmlElement new_node = doc.CreateElement(NODE_COMPONENT) doc is the System.Xml.XmlDocument() that handles the xml file. At the end of the process I use doc.appendchild(new_node) method to add the newly
node to the root and at this moment a blank namespace definition is added (<node_name xmlns=" )
Is there a reason of why the blank namespace is added? Is there a way to prevent this?<br/>
Thanks.

View the full article
 
Back
Top