Sunday, 19 January 2014

Good Example of how to create a Xml Document


XDocument doc = new XDocument(
new XDeclaration("1.0", "gautam1234", string.Empty),
new XElement( "products",
new XElement( "product",
new XAttribute( "id", "01" ),
new XElement( "Name", "Java" ),
new XElement( "Price", "Free" ) ),
new XElement( "product",
new XAttribute( "id", "02" ),
new XElement( "Name", "C#" ),
new XElement( "Price", "Free" )
) ) );


doc
.Save(@"C:\Test.xml");
gautam1234"?>

 
    Java
    Free
 

 
    C#
    Free
 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.