Skip to content

Escape '"' in XMLPrinter::PrintString when processEntities is false - #1112

Open
darshan-mog wants to merge 1 commit into
leethomason:masterfrom
darshan-mog:preserve-entities-attr-quote
Open

darshan-mog wants to merge 1 commit into
leethomason:masterfrom
darshan-mog:preserve-entities-attr-quote

Conversation

@darshan-mog

Copy link
Copy Markdown

With entity processing off (XMLDocument doc(false)), XMLPrinter::PrintString writes attribute values raw, but PushAttribute always wraps them in double quotes, so a " read from a single-quoted attribute ends the value early: <user name='bob" role="admin'/> has no role attribute, yet Print() saves it as <user name="bob" role="admin"/>, which reloads with role="admin" (values set with SetAttribute() break out the same way). Escape " as &quot; in that branch only, so entity references in attribute values and all text output still pass through unchanged, and add a regression test next to the existing preserve-entities print test from #651.

With entity processing off, attribute values are written raw but always
inside double quotes. A '"' read from a single-quoted attribute then ends
the value early, so <user name='bob" role="admin'/> is saved as
<user name="bob" role="admin"/> and reloads with a role attribute.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant