[jdom-interest] don't validate comments

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Dec 5 04:49:29 PST 2002


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.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list