Search code examples
c++xmltinyxml

How do I get the name of a tag in TinyXML?


For example:

test.xml

<fruit taste="good">whatever</fruit>

How can I get the name-string of the tag "fruit" (which would be "fruit" of course) using TinyXML?


Solution

  • Use TiXmlElement::Value()

    The Value function returns different things based on the type.

        Document:   filename of the xml file
        Element:    name of the element
        Comment:    the comment text
        Unknown:    the tag contents
        Text:       the text string