- From #
GROOVY-4115, StreamingMarkupBuilder provides option for using double quotes around attributes. But if we use this option, it can output invalid xml:
- For example:
- Produce the following output, which is invalid.
- Another example:
- Produce the following output
- However, it should produce
- As far as we know, MarkupBuilder will escape the apostrophe if the value is for an attribute, as opposed to element content, and if the builder is configured to surround attribute values with single quotes.
- So if we use the MarkupBuilder to build the above html block:
- It will produce the similar xml as the above, except the apostrophe entity
- The single-quote should be displayed instead of the entity ( ' ) in both of the builders when attributes are surrounded by double quotes. It appears that StreamingMarkupBuilder is not communicating useDoubleQuotes to StreamingMarkupWriter. One solution we can think of is passing in useDoubleQuotes to the StreamingMarkupWriter from the StreamingMarkupBuilder in the constructor and changing StreamingMarkupWriter to use similar logic to MarkupBuilder when checking attribute value for quotes to escape.