See inline below...

Saravanan Subbiah wrote:
On Fri, 05 Nov 2004 22:17:34 -0600
Keith Visco <[EMAIL PROTECTED]> sed :



Saravanan Subbiah wrote: > Hi all, > > I am trying to see find XSD Key and KeyRef support in castor. I > see that castor generates KeyRef classes. But does it actually > validates it? > > I think no. I wrote a test program which adds an invalid reference > and tried to Marshal it and it went thru fine !



No, Key and Keyref are not supported. Only ID and IDREF at this time, which of course limits the ID to be globally unique. It shouldn't take
much to add the Key / Keyref support but there is no one available to work on it at the moment.


Can you please let me know where to start looking to implementing this
? I can give it a shot if I get some time.

UnmarshalHandler and IDResolver are the two primary places that would require changes.



I also want to be able to easily get the refered Object from the KeyRef and Key Object from the refered Object. That way the application doesn't have to maintain any hashmaps for such traversal.

Something like

Order o = (Order) orderKeyRef.getReferedObject();

and

OrderKeyRef okr = (OrderKeyRef) order.getKeyRef();

I am not sure how difficult it is to implement this.  Any thoughts on
this ?

If you experiment with ID and IDRef you'll see that the Castor UnmarshalHandler adds the actual object reference for IDREF. When you marshal, the ID is obtained you only get the IDREF in the XML, but during Unmarshalling Castor finds the object references and puts that in the actual IDRef field. So basically this is the way it already works.


--Keith



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to