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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve single values from an XML string in VB.NET?

Status
Not open for further replies.

jwarmuth

IS-IT--Management
Sep 22, 2001
151
CA
Okay, I wrote a little program that returns a string of XML data from a webservice, formats the string, adds the appropriate header information and saves it to a file.

What I need is to retrieve each of the values individually (no big deal, there's only about 15, and they (the node names) are always the same) and convert them to their appropriate format before submitting to a database.

I'll give you some of the code I'm working with.

Here's a sample of the XML file being retrieved:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<Stock><Symbol>INTC</Symbol><Last>23.98</Last><Date>11/22/2004</Date><Time>1:53pm</Time><Change>-0.18</Change><Open>23.95</Open><High>24.01</High><Low>23.82</Low><Volume>38458676</Volume><MktCap>151.6B</MktCap><PreviousClose>24.16</PreviousClose><PercentageChange>-0.75%</PercentageChange><AnnRange>19.64 - 34.60</AnnRange><Earns>1.14</Earns><P-E>21.19</P-E><Name>INTEL CORP</Name></Stock>

I can call the readXML() method of my dataset to successfully load the XML data from file and display it, but I don't want to yet. I don't get the schema from this webservice so I have to manually validate and convert the returned values (unless somebody can tell me a better way!).

Problem is, I can't find a way to just pull the values node by node from the XML string or file. Suggestions? TIA!

Jeff Warmuth
MCSE, CNE
ICQ 129152989
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top