1

I am trying to write and to read/parse MathMl content XML files with boost ptree (property_tree)I cannot seep. I cannot solve to write or to parse this code:

<?xml version="1.0" encoding="utf-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <cn type="rational">1<sep/>2</cn>
</math>

The problem is the "sep/". When I use get_value() or get() with string or int I get "12". I cannot separate the 1 and the 2. How can I get or write the two separate values "1" and "2".

EckhardN
  • 469
  • 5
  • 11

1 Answers1

0

Boost Property Tree is not an XML parser.

Instead, it's a settings persistency utility, that facilitates to

  • (de) serialize a certain set of hierarchical data types
  • to a number of (partly interchangeable) formats

Note that the featureset for each format is not the same.

Specifically for your goal you need a parser that handles mixed-content elements (elements containing both text and sub-elements, mixed). There's a surprising number of XML parsers that don't handle this. Boost Property Tree is (uses?) such a parser.

So, you should look at another library to get you this.

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633