Search code examples
c++tinyxml

Find Specific Text Values With TinyXML


i have xml file like below.I want to find specific text values in different times.How can i access the text values with TinyXML

    -<language>
      <text value="Advanced Sensor Controls" parameter="title"/>
      <text value="Refresh" parameter="refresh_button"/>
      <text value="Show" parameter="button_show"/>
      <text value="Hide" parameter="button_hide"/>
      <text value="Raw Command" parameter="label_raw_command_title"/>
      <text value="Expected RX" parameter="label_raw_command_expected_rx"/>
    </language>                                                   

Solution

    1. Open the TiXmlDocument;
    2. Get the root TiXmlElement;
    3. Get the FirstChild() named 'text';
    4. Get the value of the Attribute() named 'value', do something with it;
    5. Get the NextSibling() element named 'text';
    6. Repeat until no more siblings.