如何使用 FirstCHildElement 从 xml 标记获取值
我正在 C++ 工作。我想问一下如何获取值文本:
<message> text </message>
我有
TiXmlHandle handle(&doc);
TiXmlElement* section;
section=doc.FirstChildElement("message");
从现在开始该怎么做?我知道我必须使用 .Element()
但我不知道如何操作。
I am working in C++. I would like to ask how to obtain the value text from:
<message> text </message>
I have
TiXmlHandle handle(&doc);
TiXmlElement* section;
section=doc.FirstChildElement("message");
How to do it from now on? I know I have to work with .Element()
but I don't know how.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用函数
GetText()
来获取
的内容。我将 XML 内容放入名为dummy.xml
的文件中,并使用以下代码打印内容:You can use the function
GetText()
to obtain the contents of<message>
. I put your XML-contents in a file calleddummy.xml
and used the following code to print the contents: