samedi 30 mars 2019

XPATH use in c++ boost

Is there any way of XPATH usage in boost similar to C# (SelectSingleNode() etc).

I am trying with boost::property_tree::ptree, but it is bit different than C#/VBA XML parsing.

<?xml version="1.0"?>
<Classes>

  <Class name="first">
   <Elements>
    <ElementA>aa</ElementA>
    <ElementB>bb</ElementB>
   </Elements>
  </Class>

  <Class name="second">
   <Elements>
    <ElementA>cc</ElementA>
    <ElementB>dd</ElementB>
   </Elements>
  </Class>

  <Class name="third">
   <Elements>
    <ElementA>ee</ElementA>
    <ElementB>ff</ElementB>
   </Elements>
  </Class>

</Classes>

I have to iterate on this kind of config and select subtree on the basis of Classes/Class[@name] attribute.

How can I do this with ptree.

Aucun commentaire:

Enregistrer un commentaire