[jdom-interest] CDATA does not seem to work with JDOM

Michael Hinchey michael.hinchey at inference.com
Sun Jun 4 00:43:01 PDT 2000


Valid with MSIE doesn't always mean it's valid.  :)

Change the DTD to this:
<!ELEMENT myxml (tag+)>
<!ELEMENT tag (#PCDATA)>

It will work for both JDOM and MSIE.

-Mike 


-----Original Message-----
From: Waqas Shafiq
To: jdom-interest at jdom.org
Sent: 6/3/00 10:44 PM
Subject: [jdom-interest] CDATA does not seem to work with JDOM

I have written a simple xml file that includes a tag with CDATA section.
MS Internet Explorer opens the file without any problems but when I try
to build a Document object of this xml file, jdom throws the following
exception:
 
----------------------------------------------
java.io.IOException: Error on line 5 of XML document: The content of
element type "tag" is incomplete, it must match "(CDATA)".
        at
org.jdom.adapters.XercesDOMAdapter.getDocument(XercesDOMAdapter.java:125
)
        at org.jdom.input.DOMBuilder.build(DOMBuilder.java:151)
        at org.jdom.input.AbstractBuilder.build(AbstractBuilder.java:95)
        at MyDOMBuilder.main(MyDOMBuilder.java:44)
----------------------------------------------
 
The xml file is given below along with the DTD:
 
------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE myxml SYSTEM "MyDtd.dtd">
<myxml>
 <tag><![CDATA[ABC & DEF]]></tag>
</myxml>
------------------------------------------------------
<!ELEMENT myxml (tag+)>
<!ELEMENT tag (CDATA)>
------------------------------------------------------
 
 



More information about the jdom-interest mailing list