Hi Jon,
The source code generator does not support key, keyref, and unique at this time. This should be documented on the website (http://castor.exolab.org/xmlschema.html) and in the SourceGeneratorUser.pdf Thanks, --Keith Jon Ferguson wrote: > > Hey all, > > I've found Castor to be an extremely helpful tool. It does a bunch of > stuff that make things easier... however I can't figure out if it will > do the > following in regards to generating classes from XML Schema. Anybody try > this? Or perhaps there is just a better way to approach the problem. > > I'm using <unique>, <key> and <keyref> s in my .xsd file to catch Id > checking of related elements. > > If element A has a unique key attribute called "uniqueAKey" and key > called "aKey" then I would like element > B to reference A via something like: > <xsd:keyref name = "myA" refer = "aKey"> > <xsd:selector..... > <xsd:field ..... > </xsd:keyref> > > I've prototyped this, generated classes using Castor and everything is > fine.. but unwieldy. > > The result is that I have to extract Object A's key field to stuff it > into Object B. If you wrap the keyref in an element you get a class > wrapper > on the id. Then you call something like > setWrapper(wrapperClassInstance) on B. > > What would be smoother would be if to get Castor to recognise that the > type of the reference and generate a method that sets the Id via the > type or > interface. > > Rather than: > > class B { > String _aId; > void setARef(String aref) { > _aId = aref; > } > } > > where > class A{ > String id; > ...} > > have: > class B { > void setARef(A a) { > _aId = a.getId(); > } > } > > And in actuality it would be even better if A could be an interface.. > > That would enable a proxy to be generated to the real A and open up the > world to EJBs and other cool proxy stuff. > > Does anyone know if this is already supported and how to accomplish it?? > > Thanks for your help, > > Jon ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
