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

Waqas Shafiq wshafiq at yahoo.com
Sat Jun 3 22:44:12 PDT 2000


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20000604/2d7b598e/attachment.htm


More information about the jdom-interest mailing list