[property_tree] RapidXML needs updating

Hi, There is an existing problem with the version of rapidxml included with boost::property_tree (from the trunk, I have this as an SVN external into my own repository for my own project in preparation for it getting into boost proper). If I have something like: <field> </field> The intention is obviously to have the value of field be a space. Since spaces are trimmed and condensed, something like: <field> </field> will not work. It seems that condensing of whitespace is happening AFTER the expansion of the NN; expansion (similarly with NNN;). This is obviously an error, because otherwise there is no way for me to have a space as the first or last character (or have multiple spaces in a row). It seems this bug is coming from RapidXML itself. I noticed the version of RapidXML is 1.0. So I downloaded the new version of RapidXML (1.13), and made the necessary changes in xml_parser_read_rapidxml.hpp (namely changing first_child() to first_node() ) and the above problem is fixed. So I would like to request that whoever is maintaining this update the version of RapidXML to the latest one available from the RapidXML website. As an addendum, it would be REAL nice if one could use flags to turn on or off string condensing and trimming. RapidXML provides options for both. Oh, and you might also want to fix this warning: In file included from /sandbox/mantra/trunk/Mantra-I/boost/property_tree/detail/json_parser_read.hpp:18, from /sandbox/mantra/trunk/Mantra-I/boost/property_tree/json_parser.hpp:14, from /sandbox/mantra/trunk/Mantra-I/src/core/admin/command.cpp:20: /sandbox/boost/boost/spirit.hpp:18:4: warning: #warning "This header is deprecated. Please use: boost/spirit/include/classic.hpp" (Remember that I have property_tree as an SVN external pointing to the property_tree directory in boost's trunk, so the above IS current boost head code). Minor issue. PreZ :)

Preston A. Elder wrote:
There is an existing problem with the version of rapidxml included with boost::property_tree (from the trunk, I have this as an SVN external into my own repository for my own project in preparation for it getting into boost proper).
If I have something like: <field> </field>
The intention is obviously to have the value of field be a space. Since spaces are trimmed and condensed, something like: <field> </field> will not work.
It seems that condensing of whitespace is happening AFTER the expansion of the NN; expansion (similarly with NNN;). This is obviously an error, because otherwise there is no way for me to have a space as the first or last character (or have multiple spaces in a row).
I think this is the right behaviour. BTW, if you want to get <field> with one space inside, you should write: <field xml:space="preserve"> </field> or <field xml:space="preserve"> </field>

Dmitry Vinogradov wrote:
If I have something like: <field> </field>
I think this is the right behaviour.
I do not. As far as I know, NN; and NNN; is supposed to be treated literally, and inserted as such. For example, even this should work: <field> </field> And should result in 3 spaces, without any special attributes required. And I'm a little bolstered in this opinion by the fact that between 1.0 and 1.13 of RapidXML the behavior changed to match my expectation ;)
BTW, if you want to get <field> with one space inside, you should write: <field xml:space="preserve"> </field> or <field xml:space="preserve"> </field>
The space preservation only happens when you already HAVE a non-space character in the data, for example: <field xml:space="preserve">] </field> works, because of the ']', but just: <field xml:space="preserve"> </field> does not. And as I said before, if is being treated as if it were some character that should be treated literally in this case. As an aside, with RapidXML v1.0, the second case above, NEITHER your second case: <field xml:space="preserve"> </field> works, NOR does the first of my cases above, namely: <field xml:space="preserve">] </field> Yeilding '' and ']' respectively. In 1.13, both work properly (yeilding ' ' ad '] ' respectively). So I return to my original point, something got fixed between 1.0 and 1.13, and it should be used in boost :) PreZ :)

Preston A. Elder wrote:
It seems this bug is coming from RapidXML itself. I noticed the version of RapidXML is 1.0. So I downloaded the new version of RapidXML (1.13), and made the necessary changes in xml_parser_read_rapidxml.hpp (namely changing first_child() to first_node() ) and the above problem is fixed.
I'll be sure to update RapidXML when I update the parsers. Sebastian
participants (3)
-
Dmitry Vinogradov
-
Preston A. Elder
-
Sebastian Redl