XML 파일에서 boost :: property_tree :: ptree를로드합니다. 다음과 같이 보입니다.boost :: propertytree의 childnodes를 반복하는 방법, 이것들에 childs 자체가있는 경우는?
<bla>
<foo>
<element id="1" type="..." path="..."/>
<element id="2" type="..." path="..."/>
<element id="3" type="..." path="..."/>
<otherelement/>
</foo>
</bla>
read_xml을 사용하여 속성 트리에로드합니다. 이제 element
태그와 유사한 구조체가 포함 된 벡터를 작성하려고합니다. 나는 다음과 같이 할 수있다 :
BOOST_FOREACH(ptree::value_type& node, tree.get_child("bla.foo"))
{
if (node.first == "element")
{
...
}
}
지금까지는 좋았지 만, 요소에서 데이터를 가져 오는 데 문제가있다. node.second
에 포함되어 있어야하지만 어떻게 올바르게 액세스 할 수 있습니까? node.second.get("xmlattr.type")
가 작동하지 않습니다.