.NET: XDocument missing XDeclaration?

Posted by JamesBrownIsDead on Stack Overflow See other posts from Stack Overflow or by JamesBrownIsDead
Published on 2010-05-03T23:02:42Z Indexed on 2010/05/03 23:08 UTC
Read the original article Hit count: 319

Filed under:
|
|
|

When I write out this to the console, the output is missing the XDeclaration content. What gives?

        var map = new XDocument(
            new XDeclaration("1.0", "UTF-8", null),
            new XElement(SiteMap.Namespace + "urlset")
        );

        Console.Write(map.ToString());

How do I get the XML for map including the <?xml...> declaration?

© Stack Overflow or respective owner

Related posts about xdocument

Related posts about ASP.NET