c++ boost xml parser ptree.get function -- doesnot accept white space in node name -
trying content xml file using boost xml parser using c++..
opencv.xml
<opencv_storage> <labels type_id="opencv-matrix"> <data>0 0 0 0 1 1 0 0</data> </labels> </opencv_storage>
c++ code snippet
using boost::property_tree::ptree; ptree pt; boost::property_tree::read_xml("opencv.xml", pt); std::string m_file = pt.get<std::string>("opencv_storage.labels type_id=\"opencv-matrix\".data"); std::cout<<"m_file "<<m_file<<std::endl;
while executing, program throws exception :
no such node (opencv_storage.labels type_id="opencv-matrix".data)
i doubt, white space prevails between labels , type_id
thanks in advance, appreciated, since trying used boost.
of course doesn't. whitespace in element names illegal in xml.
what want attributes: parsing xml attributes boost
or, better yet, want use xml parser, here: what xml parser should use in c++?
if somehow want use poperty tree (are sure?) here:
the enumerate-path function can - - used xml too, since takes ptree
Comments
Post a Comment