pontoNETpt
A comunidade PontoNetPT está direccionada a todos os programadores que trabalhem com a plataforma .NET.
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 :)


Posted 30-5-2008 18:56 por Pedro Rainho

Add a Comment

(requerido)  
(opcional)
(requerido)  
Remember Me?
If you can't read this number refresh your screen
Enter the numbers above:  
Powered by Community Server (Commercial Edition), by Telligent Systems