Simple XML parser in vb.net?

Discussion in 'ASP .Net' started by MattB, Jan 2, 2004.

  1. MattB

    MattB Guest

    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!"
    MattB, Jan 2, 2004
    #1
    1. Advertising

  2. 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
    Craig Deelsnyder, Jan 2, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    799
    Paul King
    Oct 5, 2004
  2. arne
    Replies:
    0
    Views:
    343
  3. Erik Wasser
    Replies:
    5
    Views:
    429
    Peter J. Holzer
    Mar 5, 2006
  4. Sean
    Replies:
    3
    Views:
    253
    robic0
    Oct 3, 2006
  5. Sean
    Replies:
    0
    Views:
    359
Loading...

Share This Page