<%@ Import Namespace="System.Xml" %>
<script language="VB" runat=server>
sub Page_Load(Sender as Object, e as EventArgs)
dim reader as XMLTextReader
dim i as integer
dim curPrice as Decimal
try
reader = new XMLTextReader(Server.MapPath("Data.xml"))
While reader.Read()
Select Case reader.NodeType
Case XMLNodeType.Element
if reader.HasAttributes then
for i = 0 to reader.AttributeCount - 1
Response.Write(reader.GetAttribute(i) & " ")
next
Response.Write("<br>")
end if
Case XMLNodeType.Text
Response.Write(reader.Value & "<br>")
End Select
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: Data.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>