<%@ Page Language="VB" %>
<%@ Import Namespace="System.Xml" %>
<script runat=server>
sub Page_Load(Sender as Object, e as EventArgs)
dim reader as XMLTextReader
try
reader = new XMLTextReader(Server.MapPath("books.xml"))
While reader.Read()
Response.Write("<b>" & reader.Name & "</b> " & _
reader.Value & "<br>")
End While
catch ex as Exception
Response.Write("Error accessing XML file")
finally
reader.close
end try
end sub
</script>
<html><body>
</body></html>
File: books.xml
<?xml version="1.0"?>
<bookstore>
<book genre="asdf">
<title>asdf</title>
<author>
<first-name>asdf</first-name>
<last-name>asdf</last-name>
</author>
<price>asdf</price>
</book>
<book genre="asdf">
<title>asdf</title>
<author>
<first-name>asdf</first-name>
<last-name>asdf</last-name>
</author>
<price>asdf</price>
</book>
<book genre="asdf">
<title>asdf</title>
<author>
<first-name>asdf</first-name>
<last-name>asdf</last-name>
</author>
<price>asdf</price>
</book>
</bookstore>
|