How to read XML from a string variable??

  • Thread starter Thread starter gwhite1
  • Start date Start date
G

gwhite1

I am trying to get data from a web service. The service returns a
string like this:

<string
xmlns="http://www.webserviceX.NET/"><StockQuotes><Stock><Symbol>TEVA</Symbol><Last>33.25</Last><Date>10/27/2006</Date><Time>4:00pm</Time><Change>-0.37</Change><Open>33.62</Open><High>33.63</High><Low>33.19</Low><Volume>4080868</Volume><MktCap>25.426B</MktCap><PreviousClose>33.62</PreviousClose><PercentageChange>-1.10%</PercentageChange><AnnRange>29.22
- 45.91</AnnRange><Earns>0.084</Earns><P-E>400.24</P-E><Name>TEVA PHARM
INDS A</Name></Stock></StockQuotes></string>

I cannot figure how to extract the XML element (like LAST). I know I
could search the string for the data but I assume VB has a way to move
the string to a XML variable and then use something like variable.LAST
to get the last field. Any help would be appreciated!!!!

Sheila
 
I am trying to get data from a web service. The service returns a
string like this:

<string
xmlns="http://www.webserviceX.NET/"><StockQuotes><Stock><Symbol>TEVA</Symbol><Last>33.25</Last><Date>10/27/2006</Date><Time>4:00pm</Time><Change>-0.37</Change><Open>33.62</Open><High>33.63</High><Low>33.19</Low><Volume>4080868</Volume><MktCap>25.426B</MktCap><PreviousClose>33.62</PreviousClose><PercentageChange>-1.10%</PercentageChange><AnnRange>29.22
- 45.91</AnnRange><Earns>0.084</Earns><P-E>400.24</P-E><Name>TEVA PHARM
INDS A</Name></Stock></StockQuotes></string>

I cannot figure how to extract the XML element (like LAST). I know I
could search the string for the data but I assume VB has a way to move
the string to a XML variable and then use something like variable.LAST
to get the last field. Any help would be appreciated!!!!

Sheila

Shelia,

You could always load the xml string into an XmlDocument and use that
to navigate the xml.
 
Back
Top