473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ 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 917
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(sX ml)

....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.nosp am> wrote in message
news:%2******** ********@TK2MSF TNGP11.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.Loa dXml 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/
frlrfsystemxmlx mldocumentclass loadxmltopic.as p

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.Loa dXml 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/
frlrfsystemxmlx mldocumentclass loadxmltopic.as p

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/cpconreadingxml withxmlreader.a sp

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(xml Reply)

Dim actNbr As XmlNodeList = doc.GetElements ByTagName("acco unt_number")
Dim replyCode As XmlNodeList = doc.GetElements ByTagName("repl y_code")

MessageBox.Show ("Account: " & actNbr(0).Inner Text)
MessageBox.Show ("Reply code: " & replyCode(0).In nerText)

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/cpconreadingxml withxmlreader.a sp

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/cpconReadingXML WithXmlReader.a sp

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
7651
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, GROUP, etc. Thank you, Brian
12
8706
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"; ..... sscanf(foo,"%s%*%s%*%s%*%s%*%s",s1,s2,s3,s4,s5); <snippet/> This is giving me junk .
29
4244
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
1381
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 problem I'm having is that one of the data values has commas in it so its blowing up on the other fields. How can I remove the commas from my string if they exist? example: Getting this BMW, Used, 325C, $19,252.00, Smith
3
2696
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 RN(name, regex): """protect using () and give an optional name to a regex""" if name:
0
8010
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8433
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8429
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8084
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8300
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5461
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3922
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3969
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1550
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.