Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Simple XML parser in vb.net?

Reply
Thread Tools

Simple XML parser in vb.net?

 
 
MattB
Guest
Posts: n/a
 
      01-02-2004
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

--

Matt

"Gravity. It's not just a good idea, it's the law!"


 
Reply With Quote
 
 
 
 
Craig Deelsnyder
Guest
Posts: n/a
 
      01-02-2004
MattB wrote:
> 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.

---
Craig Deelsnyder
Microsoft MVP - ASP.NET
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 3 10-03-2006 01:23 AM
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 0 10-02-2006 06:20 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
XML-Parser to XML-Parser communication (encoding issues?) arne Perl Misc 0 09-13-2005 12:53 PM
XML Parser VS HTML Parser ZOCOR Java 11 10-05-2004 01:58 PM



Advertisments