Create a new xml file and display it in browser


/ Published in: VB.NET
Save to your folder(s)

Create a new xml file and display it in browser


Copy this code and paste it in your HTML
  1. Dim products As New XDocument(New XDeclaration("1.0", "utf-8", ""), _
  2. New XElement("products", _
  3. New XElement("product", _
  4. New XAttribute("id", "p1"), _
  5. New XElement("name", "Alpha"), _
  6. New XElement("price", "1200"), _
  7. New XElement("stock", "19"), _
  8. New XElement("country", "Germany"))))
  9. products.Save(Server.MapPath("products-linq.xml"))
  10.  
  11. Response.Redirect("products-linq.xml")
  12. 'load file in browser

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.