Simple XML parser in vb.net?

M

MattB

I get a string returned from a C++ COM+ object that will look something
like this if the call is successful:

"OK: <guest_no>1234567890</guest_no>"

I do a
if mid(mystring, 5) = "OK: "

to test for success, and then I'd like to just parse out that guest_no
value. Is there a simple call to do this from a string? Everything I've
found in terms of examples and documentation seems a lot more complicated
than what I need to do. I'd love to have something like guest_no =
obj.parse(mystring, "guest_no"). Is there anything like that? Thanks!

Matt
 
C

Craig Deelsnyder

MattB said:
I get a string returned from a C++ COM+ object that will look something
like this if the call is successful:

"OK: <guest_no>1234567890</guest_no>"

I do a
if mid(mystring, 5) = "OK: "

to test for success, and then I'd like to just parse out that guest_no
value. Is there a simple call to do this from a string? Everything I've
found in terms of examples and documentation seems a lot more complicated
than what I need to do. I'd love to have something like guest_no =
obj.parse(mystring, "guest_no"). Is there anything like that? Thanks!

Matt

Use an XmlDocument object, there's a LoadXml method that takes a string,
and puts it in the document object. If it's not really compliant XML
(unlike your example), I might suggest using a regular
expression/pattern matching.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top