473,394 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Parsing XML strings

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

Mar 7 '06 #1
3 1091
<al*****@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/>

Mar 7 '06 #2
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.

Mar 7 '06 #3
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)


al*****@altavista.com wrote:
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

Mar 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Peter Sprenger | last post by:
Hello, I hope somebody can help me with my problem. I am writing Zope python scripts that will do parsing on text for dynamic webpages: I am getting a text from an oracle database that contains...
10
by: Christopher Benson-Manica | last post by:
(if this is a FAQ, I apologize for not finding it) I have a C-style string that I'd like to cleanly separate into tokens (based on the '.' character) and then convert those tokens to unsigned...
4
by: Gert Van den Eynde | last post by:
Hi all, Could you give me some pointers on how to parse a text input file in C++? Most will be config-file style input (keyword = data), but some maybe 'structures' like material{ name = n,...
4
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. ...
6
by: Ulrich Vollenbruch | last post by:
Hi all! since I'am used to work with matlab for a long time and now have to work with c/c++, I have again some problems with the usage of strings, pointers and arrays. So please excuse my basic...
12
by: Simone Mehta | last post by:
hi All, I am parsing a CSV file. I want to read every row into a char array of reasonable size and then extract strings from it. <snippet> char foo="hello,world,bye,bye,world"; ........
7
by: Lucas Tam | last post by:
Hi all, Does anyone know of a GOOD example on parsing text with text qualifiers? I am hoping to parse text with variable length delimiters/qualifiers. Also, qualified text could run onto...
18
by: Atara | last post by:
In my apllication I use the following code: '-- My Code: Public Shared Function strDate2Date(ByVal strDate As String) As System.DateTime Dim isOk As Boolean = False If (strDate Is Nothing)...
6
by: bwaichu | last post by:
I am writing a very basic web server, and I need to parse the HTTP Request string that I am receiving. Are there any good C books that suggest ways to parse strings effectively? Thanks!
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.