Pedro Rainho

The important thing is never to stop questioning
posts - 118, comments - 55, trackbacks - 19

xmlns:xsi with Linq to XML

If someone needs to add a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" to a xml element using Linq to XML all you have to do is something like this

 

XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XDocument doc = new XDocument(
    new XElement("Root",
        new XAttribute(XNamespace.Xmlns + "xsi", xsi)));

maybe it's not very intuitive but works :)

Print | posted on Friday, May 30, 2008 7:54 AM

Feedback

Gravatar

# re: xmlns:xsi with Linq to XML

thanks, I have been looking around for this! really not intutive...
9/24/2008 11:54 AM | jason

Post Comment

Title  
Name  
Email
Url
Comment   

Powered by: