-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Sequence ']]>' is not escaped in PCDATA #130
Comments
|
A reliable, lightweight way to check for such sequences is to have a state machine that recognizes the |
Well, a state machine like this is a kind of a buffer, and it would require that the entire output goes through it, code point by code point. I'm not really sure it is worth the complexity it would introduce. |
I don't see what about a state machine is like a buffer at all.
I don't see the complexity you mention, either. The entire thing is one wrapper struct implementing the |
Maybe the docs should be updated to warn that closing cdata characters are not escaped. Currently the cdata function gives the impression that the closing characters are escaped: https://docs.rs/xml-rs/0.8.3/xml/writer/events/enum.XmlEvent.html#method.cdata |
The sequence
]]>
must not occur in PCDATA, but xml-rs fails to escape the>
in this sequence when emitted withEventWriter
in anXmlEvent::Characters
. xml-rs correctly gives an error when attempting to parse the erroneous document.The fault probably lies on
xml::escape::escape_str_pcdata
, which handles escaping special characters for a PCDATA context. There are two options for resolving this: either systematically escaping>
as>
or checking for the sequence]]>
specifically and only escape>
when it is part of that sequence.Sample program to reproduce the problem:
Output:
The text was updated successfully, but these errors were encountered: