如何在TinyXML中获取标签的名称?

时间:2011-09-16 17:01:08

标签: c++ xml tinyxml

例如:

的test.xml

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

如何使用TinyXML获取标签“fruit”的名称字符串(当然是“水果”)?

1 个答案:

答案 0 :(得分:11)

使用TiXmlElement::Value()

Value函数根据类型返回不同的东西。

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