cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: XMLSerializable
Date Sun, 04 Nov 2007 09:13:01 GMT
Yeah, the naming is purely coincidental. The two XMLSerializables  
(and XMLEncoders) are not related to each other in no way. I'd say we  
rename the util version (I am not so sure to what though).

It is technically possible to switch DataMap (de)serialization to  
xml.XMLEncoder|Decoder (in fact I am using that mechanism JPA XML  
loading with great success), but since it works the way it is, and  
the DataMap format is very stable, I personally have very little  
motivation to touch this code. Also probably adding 'decodeFromXML'  
to util.XMLSerializable is not worth the trouble as this is a  
specialized implementation not intended for general use.

Finally to say something good about "legacy" util.XMLEncoder/ 
util.XMLSerializable, I really like how it works for manual encoding  
of a tree. It is very intuitive and has a number of helpful utility  
methods [1]. Not coincidentally I implemented this interface for all  
JPA mapping objects (even though they are not using it to load/store  
themselves). It is invaluable for debugging chunks of the mapping.

Andrus

[1] http://cayenne.apache.org/doc/api/org/apache/cayenne/util/ 
XMLEncoder.html


On Nov 4, 2007, at 4:09 AM, Aristedes Maniatis wrote:

> There are two XMLSerializable interfaces. One in  
> org.apache.cayenne.util and one in org.apache.cayenne.xml.
>
> They are very similar but the xml package one includes decodeFromXML 
> (XMLDecoder). CayenneDataObject is the only class which implements  
> decodeFromXML(XMLDecoder).
>
> On the other hand classes which implement the util version of the  
> package instead use MapLoader to perform the decoding from XML in  
> the form of a SAX parser.
>
> * can we rename these interfaces so they are more different (I  
> think one is a SAX decoder and the other DOM), or
>
> * can CayenneMapEntry be somehow merged with XMLSerializable. They  
> apply to different classes now but I'm not sure why. (doesn't  
> everything in the map need to be XML serializable and everything  
> which is serializable is in the map?), or
>
> * should we merge the two XMLSerializable interfaces and make  
> decodeFromXML a noop where is it not used
>
> Ideally I'd have thought decodeFromXML() and encodeFromXML() are  
> always nice symmetric pairs but I'm thinking this would require a  
> change from using a SAX parser in MapLoader to using a DOM parser.
>
> I'm just trying to understand this code as I navigate through it  
> working on some other things.
>
>
> Ari
>
>
>
>
> -------------------------->
> ish
> http://www.ish.com.au
> Level 1, 30 Wilson Street Newtown 2042 Australia
> phone +61 2 9550 5001   fax +61 2 9550 4001
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>
>


Mime
View raw message