Groups | Blog | Home
all groups > dotnet xml > january 2005 >

dotnet xml : Create Node List XML dotnet


csgraham74 NO[at]SPAM hotmail.com
1/27/2005 8:58:39 AM
I am trying to find the values for the product description in the
below xml by using a node list. In most cases there may be multiple
values for <ProductDescription>. It just aint working - any ideas
greatly appreciated.

<Purchase>
<ProductCode>FR</ProductCode>
<NoOfProducts>1</NoOfProducts>
<Products>
<ProductDescription>test</ProductDescription>
<ProductPrice>150</ProductPrice>
</Products>
</Purchase>

************CODE BELOW************************
**********************************************

Dim oNode As XmlNode
Dim oNodeList As XmlNodeList

oNodeList = oXMLResponse.SelectNodes("//*/Purchase/Products")
Dim str_test As String
If Not oNodeList Is Nothing Then
Me.lbl_error.Text = oNodeList.Count

For Each oNode In oNodeList

str_test = oNode.Attributes.GetNamedItem("ProductDescription").Value()

Next

End If

Thanks in advance

Martin Honnen
1/27/2005 6:12:15 PM


[quoted text, click to view]

If you want all <ProductDescription> elements then why don't you use an
XPath to them e.g.
oNodeList =
oXMLResponse.SelectNodes("/Purchase/Products/ProductDescription")


[quoted text, click to view]

In your example XML there are no attributes at all so that doesn't help.

--

Martin Honnen
AddThis Social Bookmark Button