D
David Lozzi
Howdy,
I'm new to ASP.Net 2.0 and XML in general. I've used XML documents as
datasets plenty but never had to find a specific value in one before. Below
is a sample XML document I'm working with and my code I'm using to pull the
specific email address from the XML document. Is this the best way of doing
this? Is there a better, faster procedure?
<?xml version="1.0" encoding="utf-8" ?>
<root>
<email [email protected] name="David Lozzi"></email>
<email [email protected] name="David J. Lozzi"></email>
</root>
Dim xr As New XmlTextReader(Server.MapPath("~/xml/addresses.xml"))
xr.ReadToDescendant("root")
Do While xr.Read
If xr.HasAttributes Then
If xr.GetAttribute("name").ToString = "David Lozzi" Then
Response.Write(xr.GetAttribute("address"))
End If
End If
Loop
Thanks,
David Lozzi
I'm new to ASP.Net 2.0 and XML in general. I've used XML documents as
datasets plenty but never had to find a specific value in one before. Below
is a sample XML document I'm working with and my code I'm using to pull the
specific email address from the XML document. Is this the best way of doing
this? Is there a better, faster procedure?
<?xml version="1.0" encoding="utf-8" ?>
<root>
<email [email protected] name="David Lozzi"></email>
<email [email protected] name="David J. Lozzi"></email>
</root>
Dim xr As New XmlTextReader(Server.MapPath("~/xml/addresses.xml"))
xr.ReadToDescendant("root")
Do While xr.Read
If xr.HasAttributes Then
If xr.GetAttribute("name").ToString = "David Lozzi" Then
Response.Write(xr.GetAttribute("address"))
End If
End If
Loop
Thanks,
David Lozzi