[jdom-interest] XML formatting and java class hierarchy

Ludvig Omholt ludde-jdom at restamus.se
Fri Mar 30 05:46:49 PST 2001


On Fri, 30 Mar 2001, Kenworthy, Edward wrote:

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

Right.

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

Aah, ofcourse! That's the way to do it. Thanks!

/Ludde

> Edward
> 
> -----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
> 
> 
> Hi!
> 
> 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!
> 
> /Ludde
> 
> 

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




More information about the jdom-interest mailing list