[jdom-interest] Entities in JDOM?

Jason Hunter jhunter at xquery.com
Wed Feb 16 10:35:42 PST 2005


EntityRef represents an (unexpanded) entity reference in the document. 
It actually does have a public constructor, but it's probably not what 
you're looking for.

The DocType class exposes an "internal subset" that contains a string 
version of the internal subset you're talking about.  We didn't create a 
full object model for the internal subset because it was non-trivial and 
there wasn't much interest.  You can manipulate the string directly if 
you like.

-jh-

Kashif Riaz wrote:

> 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">]
>  
> <svg>
>  . ...................
> </svg>
> -------------------------------------------------------------------------
> 
> 
> 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
> class).
> 
> 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.
> 
> Kashif.
> kash.riaz [at] gmail.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 


More information about the jdom-interest mailing list