I've got an XmlNode that I create like this:
XmlNode nodeSecurity = xmlDoc.CreateNode(XmlNodeType.Element, "wsse", "Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
The result looks like this:
<wsse:Security />
The wsse-Namespace has already been declared by a parent node, so this node does not contain an "xmlns:wsse='...'"-attribute (unknown namespaces would have been declared in an automatic xmlns-attribute).
Now my problem: I need to declare a new namespace here, so the result looks like this:
<wsse:Security wsu:xmlns='....' />
I tried to add an attribute like this:
XmlNode attr = xmlDoc.CreateNode(XmlNodeType.Attribute, "wsu", "blabla");
nodeSecurity.Attributes.SetNamedItem(attr);
And the result is:
<wsse:Security p4:wsu="" xmlns:p4="blabla" />
Instead of:
<wsse:Security wsu:xmlns="blabla" />
What am I doing wrong here?