c# - why add xmlns="" in the attribute of a node? -
i using c# , xdcoument add nodes root element. use code:
xelement mianimalnuevo = new xelement("principalnode", new xattribute("atribute1", "value attribute 1"), new xattribute("attribute2", "value attribute 2"), new xelement("subnode","0000"));
but this:
<principalnode atribute1="value attribute 1" attribute2="value attribute 2" xmlns=""> <subnode>0000</subnode> </principalnode>
after attribute 2, see xmlns="". why? want attributes.
thanks.
this happens when have xml document has namespace defined somewhere tree.
adding element not in namespace in empty namespace (i.e., no namespace) add empty xmlns
attribute.
<xml xmlns="some_namespace_uri"> <foo>the foo element inherits 'some_namespace_uri' namespace</foo> <bar xmlns="">the bar element in no namespace</bar> </xml>
related: is xmlns="" valid xml namespace?
Comments
Post a Comment