Prevent expansion of quotes and other special characters when printing XML using RapidXML

StackOverflow https://stackoverflow.com/questions/10470347

  •  06-06-2021
  •  | 
  •  

Question

I am using RapidXML to read an XML file, parse it, do some operation and write it back.

Any text written in quotes within tag, is printed with quotes in expanded form.

Is there any flag that will prevent expansion of quotes and other special characters.

Any suggestion is welcomed.

Was it helpful?

Solution

I don't believe this will work. Writing the XML is unrelated to how it was created, and changing the parse flags would not affect it.

The whole point of printing XML DOM is to create a well-formed XML that can later be parsed; therefore, I wouldn't expect an XML library to have such an option.

If you want such functionality, you can easily write one by changing the function copy_and_expand_chars in rapidxml_print.hpp

OTHER TIPS

You probably need to turn off entity translation during parsing. Can you try by setting the parse_no_entity_translation flag during parsing?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top