[jdom-interest] Parsing a comment like <!--- Hello

Elliotte Harold elharo at metalab.unc.edu
Tue Nov 2 17:18:07 PST 2004

> That does match the production given in the XML recommendation, so it is 
> valid XML:
> Comment   ::=   '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
> The problem is that third "if" in the code, which returns "Comment data 
> cannot start with a hyphen." - according to the above production, 
> comment data *can* start with a hyphen, providing the hyphen is followed 
> by a non-hyphen. Surprised me!

I'd have to check the CVS logs to be sure, but this one's probably my 
fault. I just checked the XOM code base and I've got the same mistake 
there (fixed now, of course). Anyway, just delete the relevant if clause 
and all should be fine.

Elliotte Rusty Harold  elharo at metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!

More information about the jdom-interest mailing list