Home All Groups Group Topic Archive Search About
Author
7 Mar 2006 3:35 PM
almurph@altavista.com
Hi,

   I have XML data in a string format and want to extract the content
and parse it. Can anyone suggest any methods/techniques/ways to do this
please?

   Any comments/suggestions/code-snippets much appreciated.

Al
The XML newbie

Author
7 Mar 2006 3:42 PM
Herfried K. Wagner [MVP]
<almu***@altavista.com> schrieb:
>   I have XML data in a string format and want to extract the content
> and parse it. Can anyone suggest any methods/techniques/ways to do this
> please?

You could load the string into an 'XmlDocument' object and use its methods
to locate the content.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
7 Mar 2006 9:44 PM
zacks
As Herfried suggests, the DOM can be used and I would guess recommended
for a very simple XML file. But I have recently been impressed with the
power of .NET XMLSerialization. Even for a simple XML file, it doesn't
take very long to set up the class(s) and properties, and to read it in
or write it out only takes two method calls.
Author
8 Mar 2006 2:56 PM
cj
Just did that.  Here's what I did to retrieve the account_number and
reply_code fields from the xml string.  Hope it helps.


Dim doc As New XmlDocument
doc.LoadXml(xmlString)

Dim actNbr As XmlNodeList = doc.GetElementsByTagName("account_number")
Dim replyCode As XmlNodeList = doc.GetElementsByTagName("reply_code")

MessageBox.Show("Account: " & actNbr(0).InnerText)
MessageBox.Show("Reply code: " & replyCode(0).InnerText)




almu***@altavista.com wrote:
Show quoteHide quote
> Hi,
>
>    I have XML data in a string format and want to extract the content
> and parse it. Can anyone suggest any methods/techniques/ways to do this
> please?
>
>    Any comments/suggestions/code-snippets much appreciated.
>
> Al
> The XML newbie
>