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

TravisG picture TravisG · Sep 16, 2011 · Viewed 7.2k times · Source

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?

Answer

Sam picture Sam · Sep 16, 2011

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