Using XNamespace to create nicely formatted XML.

Posted by Steven on Stack Overflow See other posts from Stack Overflow or by Steven
Published on 2010-04-03T18:35:26Z Indexed on 2010/04/03 18:43 UTC
Read the original article Hit count: 239

Filed under:
|
|

I want to create a Xml file that looks something like this:

<Root xmlns:ns1="name1" xmlns:ns2="name2">
    <ns1:element1 />
    <ns1:element2 />
    <ns2:element3 />
</Root>

How can I accomplish this using XAttribute, XElement, XNamespace, and XDocument where the namespaces are dynamically added.

© Stack Overflow or respective owner

Related posts about linqtoxml

Related posts about xnamespace