Dmitri, It is not possible to change the code generated by Castor. Therefore I will try to implement a NodePointer-NodeIterator-NodePointerFactory. Are there any examples or documentation that may help me in this endeavour.
Best Regards Kenneth Petersen > -----Original Message----- > From: Dmitri Plotnikov [mailto:[EMAIL PROTECTED]] > Sent: 9. oktober 2002 16:52 > To: Jakarta Commons Developers List > Subject: Re: Customizing JXPath. Custom Containers. > > > Kenneth, > > I am not familiar with Castor enough to give you specific > recommendations, but here are some general ideas. > > 1. The mapping of paths to objects in JXPath is based on the JavaBean > specification. So, I guess I would first look into flattening > properties to make the beans conform strictly to the JavaBean > spec. For > example, if Request had a method like > > public Errors getErrors(){ > return getRequestChoice().getErrors(); > } > > you could get the Errors object (or null) with the "/request/errors" > path. > > 2. If adding code to the Castor-genned classes is not an option, you > might consider writing a NodePointer-NodeIterator-NodePointerFactory > familiy of classes for specific support of Castor-style objects. This > may be a little involved, as APIs of those classes, especially > NodePointer, are rather wide. You might be able to inherit your > implementations from BeanPointer, etc, thus re-using some of the > JavaBean support for the Castor object. > > Let me know if any of this helps. > > - Dmitri > > > --- Kenneth Petersen <[EMAIL PROTECTED]> wrote: > > Hi. > > > > I am using Castor for creating java objects capable of containing > > data > > conforming to certain xsd-schemas. When using Castor to > create a java > > structure capable of containing data of xml entities following > > schema: > > > > <xs:element name="Request"> > > <xs:complexType> > > <xs:sequence> > > <xs:choice> > > <xs:element name="Success" > > type="SuccessType"/> > > <xs:element name="Errors" > > type="ErrorsType"/> > > </xs:choice> > > </xs:sequence> > > </xs:complexType> > > </xs:element> > > > > Castor creates a "Request" class containing a "RequestChoice" > > container > > containing either a "Success" or "Errors" object. > > > > I would like to use JXPath to access the data of the java objects > > using > > X-Path expressions identifying values of the original xml-entity. > > Taking the > > example from before, I would like to use expression > "/Request/Errors" > > to > > access the "Errors" children of an xml-entity. I am not capable of > > doing > > this without being able to configure JXPath so that properties of > > classes > > "Xxx" following the naming pattern "XxxChoice" are identifies as > > being > > containers. Is this at all possible? If so some clues as to how this > > is > > accomplished would be much appreciated. > > > > Best Regards > > Kenneth Petersen > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > __________________________________________________ > Do you Yahoo!? > Faith Hill - Exclusive Performances, Videos & More > http://faith.yahoo.com > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>