C
Christoph
I'm using the following code to create what will be the root element of my
XML document.
XmlDocument controlDocument = new XmlDocument();
//add root node
XmlElement rootNode = controlDocument.CreateElement( "ns0:MyRootElement" );
rootNode.SetAttribute( "xmlns:ns0", "http://my.namespace.uri" );
controlDocument.AppendChild(rootNode);
I'm trying to get it so that it comes out as follows:
<ns0:MyRootElement xmlns:ns0="http://my.namespace.uri">
</ns0:MyRootElement>
however, when I'm print out the XML document, it's only printing out as
such:
<MyRootElement xmlns:ns0="http://my.namespace.uri">
</MyRootElement>
Why is it getting rid of the beginning 'ns0:'? And what can I do to keep it
in there?
thnx,
Christoph
XML document.
XmlDocument controlDocument = new XmlDocument();
//add root node
XmlElement rootNode = controlDocument.CreateElement( "ns0:MyRootElement" );
rootNode.SetAttribute( "xmlns:ns0", "http://my.namespace.uri" );
controlDocument.AppendChild(rootNode);
I'm trying to get it so that it comes out as follows:
<ns0:MyRootElement xmlns:ns0="http://my.namespace.uri">
</ns0:MyRootElement>
however, when I'm print out the XML document, it's only printing out as
such:
<MyRootElement xmlns:ns0="http://my.namespace.uri">
</MyRootElement>
Why is it getting rid of the beginning 'ns0:'? And what can I do to keep it
in there?
thnx,
Christoph