I want to be able access an xml file using an XPath? query to go to a
specific node. Once I have that node I want to be able to retrieve the value
of an attribute. Can't seem to get this working using the 2.0 Framework.
Here's a sample of the XML
<Agency>
<vu_Agency AgencySysNo="1" Name="Dept 1"/>
<vu_Agency AgencySysNo="2" Name="Dept 2"/>
</Agency>
The code I'm playing with is...
Dim document As XPathDocument = New
XPathDocument(ConfigurationManager.AppSettings("xm lPath").ToString() &
"Agency.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()
Dim agencySysNo As Integer = 2
Dim exp As XPathExpression =
navigator.Compile("/Agency/vu_Agency[@AgencySysNo=" & agencySysNo & "]")
Dim nodes As XPathNodeIterator
nodes = navigator.Select(exp)
Dim nodesNavigator As XPathNavigator = nodes.Current
Dim nodesText As XPathNodeIterator =
nodesNavigator.SelectDescendants(XPathNodeType.Tex t, True)
Response.Write(nodesText.Current.Value)
Thanks for any help....
--
Mike Gasperino
Sr. Software Developer
office: 919-807-2310
************************************************** **************************
E-mail correspondence to and from this address may be subject to the North
Carolina Public Records Law "NCGS.Ch.132" and may be disclosed to third
parties
************************************************** **************************