473,480 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

parsing an xml string into fields

cj
I'm getting a small xml file as on big string and need to parse it into
it's fields for use. Can anyone point me to a nifty way to do this in .net?
Mar 6 '06 #1
8 910
cj wrote:
I'm getting a small xml file as on big string and need to parse it into
it's fields for use. Can anyone point me to a nifty way to do this in
.net?


Take a look at the xmldocument class. There is a method there that load
from a string.

Chris
Mar 6 '06 #2
YYZ
> I'm getting a small xml file as on big string and need to parse it into
it's fields for use. Can anyone point me to a nifty way to do this in .net?


dim oDom as new XMLDocument

oDom.LoadXML(sXml)

....is that what you were looking for?

Matt

Mar 6 '06 #3
http://www.kjmsolutions.com/xmlsettings.htm

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"cj" <cj@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I'm getting a small xml file as on big string and need to parse it into
it's fields for use. Can anyone point me to a nifty way to do this in
.net?

Mar 7 '06 #4
Hi,

Thanks for posting!

From your description, my understanding is that you want to read a XML
format string and obtain some values in it. If I have misunderstood
anything, please let me know.

As Matt mentioned, the XmlDocument.LoadXml method is appropriated for the
current issue. The following article from MSDN demonstrates how to approach
this:
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemxmlxmldocumentclassloadxmltopic.asp

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 7 '06 #5
cj
What do you think of this method?
http://www.fawcette.com/vsm/2002_10/...ips/esposito2/
Yuan Ren[MSFT] wrote:
Hi,

Thanks for posting!

From your description, my understanding is that you want to read a XML
format string and obtain some values in it. If I have misunderstood
anything, please let me know.

As Matt mentioned, the XmlDocument.LoadXml method is appropriated for the
current issue. The following article from MSDN demonstrates how to approach
this:
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemxmlxmldocumentclassloadxmltopic.asp

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 7 '06 #6
Hi,

Thanks for your reply!

Using the XmlReader class is also appropriated. Just for your reference:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconreadingxmlwithxmlreader.asp

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 8 '06 #7
cj
I went with Matt's and your way after all. I couldn't figure out how to
retrieve the values from the XmlTextReader.

Here's what I have now:

Dim doc As New XmlDocument
doc.LoadXml(xmlReply)

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)

This works fine but I want to learn and am always open to suggestions if
anyone has any.
Yuan Ren[MSFT] wrote:
Hi,

Thanks for your reply!

Using the XmlReader class is also appropriated. Just for your reference:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconreadingxmlwithxmlreader.asp

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 8 '06 #8
Hi,

Thanks for your reply!

If you want to use the XmlTextReader class, the following article
demonstrates how to do this:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconReadingXMLWithXmlReader.asp

Actually, the ReadInnerXml method is appropriated. Hope this will be useful!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

Mar 9 '06 #9

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

Similar topics

6
7634
by: BerkshireGuy | last post by:
Does anyone know of a good function that will parse out parts of an SQL statement that is passed to it in seperate variables? It should be able to parse statements that contain ORDERBY, WHERE,...
12
8676
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"; ........
29
4220
by: zoltan | last post by:
Hi, The scenario is like this : struct ns_rr { const u_char* rdata; }; The rdata field contains some fields such as :
4
1371
by: igotyourdotnet | last post by:
I have a question. I'm reading a CSV file that is uploading to my SQL db, I'm parsing out the file line by line. I'm getting the values and putting them into an arrayList seperate by commas. The...
3
2691
by: aspineux | last post by:
My goal is to write a parser for these imaginary string from the SMTP protocol, regarding RFC 821 and 1869. I'm a little flexible with the BNF from these RFC :-) Any comment ? tests= def...
0
7055
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
6920
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
7059
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,...
0
5362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3011
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.