This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arturcz
Recipients arturcz, eric.araujo
Date 2014-02-21.10:14:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392977693.14.0.706754690035.issue20714@psf.upfronthosting.co.za>
In-reply-to
Content
Eric, I'm not sure what exactly your concern is, but I'll try to address two issues I can see.

First: both strings <![CDATA[]]]]> and <![CDATA[>]]> are a correct and valid examples of CDATA usage as per specification[1].

Second: is it allowed to have two occurences of CDATA inside one element? The same specification says only that ‟CDATA sections may occur anywhere character data may occur”. There is nothing said if multiple occurrences are allowed or disallowed.
Wikipedia suggests in [2] that it is OK, giving the same example of embedding ]]> inside CDATA. There is no hints in Talk page that this solution doesn't work for someone.
In other example [3] there is explicitly stated that: ‟the [...] application shouldn't care about the difference between abc and <![CDATA[abc]]> and <![CDATA[a]]><![CDATA[bc]]>”.

Last but not least: using following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="foo"/>
</xs:schema>

following XML file:

<?xml version="1.0" ?>
<foo>
<![CDATA[]]]]><![CDATA[>]]>
</foo>

validates correctly with xmllint:
$ xmllint -noout --schema schema.xsd t.xml
t.xml validates

I hope it dissolves your concerns.

PS. I noticed I missed one ] in provided patch. There should be four of them in second parameter of replace.

[1] http://www.w3.org/TR/REC-xml/#sec-cdata-sect
[2] http://en.wikipedia.org/wiki/CDATA#Nesting
[3] http://oxygenxml.com/archives/xsl-list/200502/msg00787.html
History
Date User Action Args
2014-02-21 10:14:53arturczsetrecipients: + arturcz, eric.araujo
2014-02-21 10:14:53arturczsetmessageid: <1392977693.14.0.706754690035.issue20714@psf.upfronthosting.co.za>
2014-02-21 10:14:53arturczlinkissue20714 messages
2014-02-21 10:14:51arturczcreate