By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 1,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

How to read XML from a string variable??

P: n/a
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

Oct 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

gw*****@kc.rr.com wrote:
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.

--
Tom Shelton

Oct 29 '06 #2

P: n/a

Tom Shelton wrote:
>
You could always load the xml string into an XmlDocument and use that
to navigate the xml.

--
Tom Shelton
or read it by dataset (by .ReadXML)

Mrozu

Oct 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.