<%@ Page Language="VB" %>
<%@ Import Namespace="System.Xml" %>
<script runat=server>
sub Page_Load(Sender as Object, e as EventArgs)
dim writer as XMLTextWriter
try
writer = new XMLTextWriter(Server.MapPath("Data.xml"), nothing)
writer.WriteStartDocument
writer.Formatting = Formatting.Indented
writer.Indentation = 3
writer.WriteStartElement("bookstore")
writer.WriteStartElement("book")
writer.WriteAttributeString("genre", "history")
writer.WriteElementString("title", "my title")
writer.WriteElementString("price","6.99")
writer.WriteStartElement("author")
writer.WriteElementString("first-name","M")
writer.WriteEndElement()
writer.WriteEndElement()
writer.WriteEndElement()
writer.Flush
catch ex as Exception
Response.Write("Error accessing XML file")
finally
writer.Close
Response.Write("Finished processing")
end try
end sub
</script>
<html><body>
</body></html>
|