4

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?

TravisG
  • 2,203
  • 2
  • 28
  • 45

1 Answers1

13

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
Sam
  • 25,752
  • 12
  • 68
  • 97
  • 1
    Forgot to mention that if you use the STL, you can also use [TiXmlNode::ValueStr()](http://www.grinninglizard.com/tinyxmldocs/classTiXmlNode.html#74bda074919e4a5e08d700204793f898) which returns `const std:string&` instead of `const char *`. It's more efficient too. – Sam Sep 16 '11 at 17:27