3

I have XmlNode object with next attributes:

enter image description here

But when i call OuterXml Property i have all those attributes and also xmlns attribute with namespace included. But i dont wath to have this namespace there! How can i set to node properties not to show in OuterXml this attribute xmlns with namespace?

I need this clean outerxml because i use this xml in documents which already contains such namespace and i really dont need to set it in xml node.

Ievgen
  • 4,261
  • 7
  • 75
  • 124
  • 1
    Why are you using `OuterXml` for that? You should just move the whole `XmlElement` to the document you are creating. – svick Sep 10 '11 at 23:21
  • Because nodes is transferred from one system to other like text (But root documents is same) So i use OuterXML. – Ievgen Sep 10 '11 at 23:29
  • 1
    So, you're transferring XML elements that are not whole documents from one system to another? If that's the case, I think you shouldn't do that. – svick Sep 10 '11 at 23:34
  • 1
    A: what does the image show? (because it doesn't really illustrate anything about namespaces), and B: if the element *is* part of a fragment in a namespace, how could it be omitted? (meaning: it would be *correct* to include a namespace) – Marc Gravell Sep 10 '11 at 23:35
  • it shows that i have no xmlns attribute there. – Ievgen Sep 10 '11 at 23:38
  • 1
    @Evgeny: nodes have a (default) namespace always. Your namespace manager controls what prefixes (if any) are to be emitted. Note that if you are using Xml nodes from more than 1 namespace, you are bound to have xmlns declarations – sehe Sep 11 '11 at 00:09

0 Answers0