出力用のxmlを作成する必要があります。インデックス名のリストがあります。1つの形式でxmlファイルに入力したい。
あれは
<response>
<indexes>
<index>abc</index>
<index>xyz</index>
<index>pqr</index>
</indexes>
</response>
ベクトルindex_listにリストがあります。
誰かが私を助けることができますか?
私はそのためにいくつかのコードを試しました。次の
boost::property_tree::ptree tree;
stringstream output;
for (std::vector<string>::const_iterator it = index_list.begin();
it != index_list.end(); it++) {
std::cout << *it << "\n";
tree.put("response.indexes.index", *it);
}
if (format == "xml") {
write_xml(output, tree);
} else {
write_json(output, tree);
}
上記のコードを実行すると。リストの名前だけを取得しています。あれは
<response>
<indexes>
<index>pqr</index>
</indexes>
</response>