Menu

Get Values between tags

tungab
2005-08-11
2013-05-20
  • tungab

    tungab - 2005-08-11

    hi i was wondering how to get all the values between a specifed tag
    eg, <address>

    <?xml version="1.0"?>
    <skin>
    <mainmenu>
    <address>
    <image>address.bmp</image>
    <x1>7</x1>
    <x2>7</x2>
    <x3>7</x3>
    <x4>7</x4>
    </address>
    <route>
    <image>route.bmp</image>
    <x1>7</x1>
    <x2>7</x2>
    <x3>7</x3>
    <x4>7</x4>
    </route>
    </mainmenu>
    </skin>

     
    • Ellers

      Ellers - 2005-08-11

      By "values" do you mean "all elements and text nodes contained in the element named 'address'?"

      The main tinyxml test program shows lots of examples.

      This doc shows how to do a full recursive traversal, dumping the DOM to stdout:

      http://software.ellerton.net/tinyxml.html#dump-structure-of-a-document-to-stdout

      Basically you're after something like:

      for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
          {
              do_something_with_node_possibly_recursively( pChild );
          }

      HTH

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.