Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read specific values from a XML? 1

Status
Not open for further replies.

eulogy6

Programmer
Apr 30, 2004
26
Hi to all,

I‘ve a XML like the following:

<rss version="2.0">
<channel>
<title>TEST</title>
<link> </link>
<description> </description>
<language>En</language>
<webMaster> </webMaster>
<docs> </docs>
<image> <title>image</title>
<width>32</width>
<height>32</height>
<link> </link>
<url></url>
</image>
<item>
<title>today 18/8 : Product1, Product2, Product3
</title>
</item>
</channel>
</rss>

I’m trying to retrieve the values Product1, Product2 and Product3, in order to use them to sort a dataset
“Select * From Products Where Productname= “Product1” or “Product2” or “Product3”

thanx in advanced
 
thax bigtimmin for your answer.

I looked up your reference but I didn’t find any solution….

Until now I have:

PrivateSub btnShowValues_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowValues.Click
Me.TextBox1.Text = ""
Dim rd As XmlReader = XmlReader.Create("Product.xml")
While rd.Read
If rd.NodeType = XmlNodeType.Text Then
Me.TextBox1.Text &= rd.ReadString & ControlChars.NewLine
End If
End While
rd.Close()
End Sub



 
try:
oXMLDoc = New XmlDocument
'Load in your xml file
oXMLDoc.Load([XMLFilePath])
Dim oRecordList As XmlNodeList
Dim oRecordNode As XmlNode
'Get the root element
Dim oXmlElement As XmlElement = m_oXMLDoc.DocumentElement
'Get all the item/title nodes
oRecordList = oXmlElement.SelectNodes("//item/title")
'loop through all the returned nodes
For Each oRecordNode in oRecordList
'You will need to parse the contents for your data
sParseMe = oRecordNode.Innertext
'Do your thing
Next

Hope it helps, there may be some syntax errors but it should be close. (I winged it)
make sure you import System.XML

 
thanx mikegrove

that really helps....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top