[erlang-questions] beginner: xmerl:export_simple/2 wihtout changing > into >

Richard A. O'Keefe ok@REDACTED
Fri Feb 14 04:17:58 CET 2014


On 14/02/2014, at 12:32 PM, Carsten Bormann wrote:

>> Not many people are aware of the illegality of ]]> in plain
>> text.  None of the XML parsers I use is aware of it.  But it
>> has always been illegal according to the XML specifications.
> 
> If you know about CDATA sections, you should have made that conclusion…
> I would be very wary of an XML tool that doesn’t implement them.
> $ echo '<foo> ]]> </foo>' | xmllint -
> -:1: parser error : Sequence ']]>' not allowed in content
> <foo> ]]> </foo>

]]> is used to close CDATA sections.
When there _isn't_ any CDATA section,
there's no good reason for ]]> to be reserved.
It just is.
As it happens, I know very well, as my messages have made clear,
that ]]> is reserved; but since there is no obvious reason why
it should be, and since it is a pretty rare sequence, other
people aren't always aware of that.
And they should never have had to be.

Let's face it, > is _also_ used to close something,
but > is *not* reserved in SGML or XML text.

By the way, when I try that example xmllint, I get

-:1: parser error : internal error: detected an error in element content
-:1: parser error : Extra content at the end of the document

(o)nsgmls also warns about this, but as I wrote,
the parsers I normally use -- as they are much faster --
happen to be silent about this.





More information about the erlang-questions mailing list