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

Kevin Regan kevinr at valicert.com
Sun Jun 4 00:06:52 PDT 2000

You probably want:

<!ELEMENT myxml (tag+)>

The string "CDATA" inside your dtd refers
to the element name "CDATA".  You can use
CDATA as attribute types and in <![CDATA[...]]>
sections, but it is meaningless in the
example below.  The parser is simply
telling you that it can't find the
"CDATA" element.

Microsoft IE probably is not validating your
DTD.  A non-validation parser would not know
to look for the "CDATA" element...


On Sat, 3 Jun 2000, Waqas Shafiq wrote:

> 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