• Log in or sign up for an account here: https://www.sythe.org/login

Reported Post by MohtasaUnique

Status
Not open for further replies.

MohtasaUnique

Grand Master

Retired Global Moderator
Joined
Sep 1, 2007
Sythe Gold
690
Messages
6,681
MohtasaUnique has reported a post.

Reason:
Advertising with his thread titles, and wrong section
Post: cegonsoft.in | LINQ to XML
Forum: General/Off Topic
Assigned Moderators: Josh0is0here, Pokemoners, JohnK

Posted by: jonathanp198
Original Content:
Consider that we want to create the following XML Document:

<?xml version="1.0"? encoding="utf-8">

<!&#8211;Xml Document&#8211;>

<catalog>

<book id="bk001">

<title>Book Title</title>

</book>
</catalog>
</xml>

Here is how we create the same XML document using Linq to Xml classes available in the System.Xml.Linq namespace:

XDocument doc =
new XDocument(
new XDeclaration("1.0", Encoding.UTF8.HeaderName, String.Empty),
new XComment("Xml Document"),
newXElement("catalog",
new XElement("book",
newXAttribute("id", "bk001"),
newXElement("title", "Book Title")
)
)
);
doc.Save("sampleLinq.xml");
..............................................
more information at Cegonsoft
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top