add namespace to a xml document in C#

Posted by Walid F. on Stack Overflow See other posts from Stack Overflow or by Walid F.
Published on 2010-01-06T19:42:07Z Indexed on 2010/05/26 17:01 UTC
Read the original article Hit count: 309

Filed under:
|
|
|
|

Hi,

I have the following xml

<book>
   <chapter>this is a sample text</chapter>
</book>

and need to add a namespace to it to be like the one below

<ns0:book xmlns:ns0="http://mybookurl/sample">
   <chapter>this is a sample text</chapter>
</ns0:book>

I tried Greco suggestions but it does not work. http://stackoverflow.com/questions/443250/creating-a-specific-xml-document-using-namespaces-in-c

would appreciate any help!

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml