[jdom-interest] XML formatting and java class hierarchy

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Fri Mar 30 04:51:03 PST 2001

Hi Ludde

Lots of good reasons. The class might depend on it's particular interface.
Other classes might depend on its particular interface - ie the true
interface is *not* a String - it's a String formatted in a particular way.

In any case the correct class to try and do the change you are trying is not
CDATA, you should be subclassing XMLOutputter. You want the out put changed
(XMLOutputter), not the underlying model (CDATA).


-----Original Message-----
From: Ludvig Omholt [mailto:ludde-jdom at restamus.se]
Sent: 30 March 2001 13:10
To: jdom-interest at jdom.org
Subject: [jdom-interest] XML formatting and java class hierarchy


I am using the jdom beta6 (XMLOutputter) to send simple XML messages to a
server. The server, however, can't parse the "<![CDATA[" and "]]" strings.
I have contacted the folks who implemented the server and questioned their
parsing. They have not answered my email yet.

In the meantime I would like to fix this by subclassing the org.jdom.CDATA
class and override the getSerializedForm() method having it return the
getText() String instead. This is not possible because the
getSerializedForm() method is final and also there is no interface to
implement. Why must the getSerializedForm() method be final? This seems to
me to be quite dumb since it limits the use of the library.

For now I have resolved the issue by modifying my copy of jdom, but it
would be nice to use an "off the shelf" version of the library and create
my own subclass of CDATA since that is much cleaner and I don't have to
distribute my own version of the jdom JAR.

Thanks for any feedback!


  _   _ _ __  __  ___
 | | | | |  \|  \| __| Ludvig Omholt ................. ludde at restamus.se
 | |_| | | D | D | _|  070-310 08 71 ........... http://www.restamus.se/
 |___|___|__/|__/|___| ++++++++ cliff: Linux 2.2.13 on an i686 +++++++++

To control your jdom-interest membership:

More information about the jdom-interest mailing list