TinyXML2 でノードを反復するにはどうすればよいですか? ドキュメントに従ってみましたが、これを把握できません。
http://www.grinninglizard.com/tinyxml2docs/index.html
私の XML は既に にロードされていstd::string
ます。したがって、次のようにコンパイルされます。
#include "tinyxml2.hpp"
// assume I have code here which reads my XML into std::string sXML
tinyxml2::XMLDocument doc;
doc.Parse( sXML.c_str() );
doc
アイテム リストを反復処理して、内部のタイトル フィールドと著者フィールドをstd::string
変数に取り出すにはどうすればよいでしょうか。
これが私の XML サンプルです。
<?xml version=“1.0” encoding=“utf-8”?>
<books>
<item>
<title>Letters to Gerhardt</title>
<author>Von Strudel, Jamath</author>
</item>
<item>
<title>Swiss Systemic Cleanliness Principles, The</title>
<author>Jöhansen, Jahnnes</author>
</item>
</books>
vector
C++のような単純なものを望んでいてitem
、おそらく C++map
内部で"title"
and"author"
または.title
orでアドレス指定できます.author
。