[jdom-interest] don't validate comments

David Kavanagh dak at dotech.com
Thu Dec 5 07:15:03 PST 2002


I would also add the obvious. If you are checking web pages for 
well-formedness, you are settting yourself up for failure, IMHO!

David

PS i.e. the <p> and <br> tags are prime examples. almost never closed in 
the old days, not sure about now.

On 12/5/2002 7:49 AM, Elliotte Rusty Harold wrote:

> At 11:36 AM +0100 12/5/02, Christian Peter wrote:
>
>> Hi,
>>
>> I get a org.jdom.IllegalDataException telling me that "Comments 
>> cannot contain double hyphens (--)", which doubtlessly is true
>> (if you are interested, http://www.nasa.org causes the exception).
>>
>> However, I need to parse this document and since I'm not interested 
>> in the comments, I would like JDOM to simply ignore the content of a 
>> comment. I thought I can achieve this by setting 
>> DOMBuilder.setValidation to false, but I still get this Exception.
>>
>
> You are confusing validation with well-formedness checking. Validation 
> is optional. Well-formedness checking is not. The document you are 
> trying to parse is malformed. JDOM correctly refuses to work with it. 
> You must fix the document before JDOM or any other XML tool will 
> accept it.






More information about the jdom-interest mailing list