data.xml

Embedded CDATA end tags are not properly handled

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

user> (xml/indent-str (xml/sexp-as-element [:pre [:-cdata "foo]]>bar"]]))
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><pre><![CDATA[foo]]><![CDATA[bar]]></pre>\n"

What's being emitted here is cdata for foobar not foo]]>bar.

What needs to be done is break up the embedded ]]> so that the first two characters are in one cdata block, and the last character is in the next block.

The tests are wrong, as far as I can tell. I think I have fixed the code and the tests, I just need to figure out how to run the tests and submit a patch.

Activity

Hide
Jeff Weiss added a comment -

Patch that fixes issue and tests

Show
Jeff Weiss added a comment - Patch that fixes issue and tests
Hide
Jeff Weiss added a comment -

And just to clear up what the issue is, currently if the cdata contains the cdata end tag "]]>" it is just dropped and when the xml is read in those characters are gone.

That is not correct behavior, the cdata should be able to contain any arbitrary characters without any loss of data, and the attached patch will allow this.

Show
Jeff Weiss added a comment - And just to clear up what the issue is, currently if the cdata contains the cdata end tag "]]>" it is just dropped and when the xml is read in those characters are gone. That is not correct behavior, the cdata should be able to contain any arbitrary characters without any loss of data, and the attached patch will allow this.
Hide
Ryan Senior added a comment -

Thanks for the patch! It's been pushed up and will be in the next release.

Show
Ryan Senior added a comment - Thanks for the patch! It's been pushed up and will be in the next release.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: