Results 1 to 5 of 5

Thread: search xml file for text between two tags

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Location
    Illinois
    Posts
    3

    Question search xml file for text between two tags

    What's the best way to go about searching an external xml file for the text between two tags and assigning that text to a string? Some of these xml files can get rather lengthy and I'm trying to figure out the most efficient way possible.

    Thanks!
    ======================
    Chevy Blazer Owners Club
    www.blazerowners.com

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    What language will you be using?
    Mark
    -------------------

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Location
    Illinois
    Posts
    3

    VB

    Visual Basic...
    ======================
    Chevy Blazer Owners Club
    www.blazerowners.com

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    lets say you have an xml doc myxmldoc.xml that looks like this

    Code:
    <blah>
      <test>hiya</test>
    </blah>
    to get the text in test:
    Code:
    Dim xmlDoc As MSXML.DOMDocument
    Dim xmltext as string
    Set xmlDoc = New MSXML.DOMDocument
    xmlDoc.async = False
    xmlDoc.load "c:\myxmldoc.xml"
    xmltext = xmlDoc.selectSingleNode("blah/test").text
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Location
    Illinois
    Posts
    3

    Question What if you're using XSL too...

    I'm using XSLT on this XML file as well.... How would you apply a XSL transformation to the example you provided?

    Thanks for the help. Your explanation makes good sense.

    Tom
    www.blazerowners.com
    Chevy Blazer Owner's Club
    ======================
    Chevy Blazer Owners Club
    www.blazerowners.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width