zeux/pugixml

Entity not replaced on attribute

sminjard opened this issue · 5 comments

I create a quite big XML file in which there is a node named "N" and one of its attribute named "n" (yes, this is not quite readable but it was done to save space). The value of the attribute is "PISTON_BOT_COMP<01-2_PISTON_RING>.83d333b1361e09a09ba1ae5e721b497b5080eb56e913c4efdd4dfaa24e5e721b494da02e6c54" set using the xml_node::append_attribute.

When I save the xml document to a std::wostringstream using the xml_document::save method, I got the attribute's value encoded as follow : "PISTON_BOT_COMP<01-2_PISTON_RING>.83d333b1361e09a09ba1ae5e721b497b5080eb56e913c4efdd4dfaa24e5e721b494da02e6c54"

As you can see, only the entity < was replaced, but not the entity >.

I am using pugi::xml version 1.12.1 as available in conan-center.
Options : wchar_mode and header_only

It happens in the line

PUGI__SCANWHILE_UNROLL(!PUGI__IS_CHARTYPEX(ss, type));
of text_output_escaped.

The character L'>' seems to be not recognized as a special character.

The character > is not marked as ctx_special_attr, ascii code 62.

Oh apparently it is not a "must" but more a "strong recommendation. Could we have an option to follow this recommendation?

zeux commented

Can you elaborate on where the recommendation is coming from? > is not replaced with &gt; in attribute values currently because it's not necessary and it saves space.

Nevermind, it was on stackoverflow and the person who wrote it wasn't able to provide a reliable source. I close the ticket