[jdom-interest] Entities in JDOM?

Kashif Riaz kash.riaz at gmail.com
Tue Feb 15 14:47:00 PST 2005

How do you handle entities (from a DOCTYPE)  in JDOM?

I have some XML like this:

<?xml version="1.0" standalone="no"?>
<!-- Generator: Mayura Draw 4.3 -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
	<!ENTITY st6 "stroke:#000000;stroke-dasharray:10 4;stroke-width:4;fill:none">
	<!ENTITY st7 "stroke:#000000;stroke-width:0.5;fill:#ff6633">]
 . ...................

I wish to be able to edit the "<!ENTITY...>" tags for say, "st6" or
"st7 (and set and get the  values). I tried to iterate over the
elements as normal,  but I cannot get JDOM to "see" any of the
entities in the DOCTYPE (I can get everything else from the DOCTYPE
apart from the entity declarations - the stuff after the .dtd
declaration in square brackets which is what I want, using the Doctype

I've looked at the EntityRef class in the JDOM API but I'm still lost,
especially since it contains protected constructors. How should this
be used with the above XML?

Any ideas on either that or any other way?

Any help appreciated.

kash.riaz [at] gmail.com

More information about the jdom-interest mailing list