At a client site, I'm using CastorXML 0.9.3.  I'm a Castor newb, but I have
used other XML bindings like XMLBeans, pyXml, etc.

Operating on generated code, what options do I have for querying and/or
limiting results?  What is the "right" way?  For example:

<dog breed="Lab">
 <id name="John"/>
 <fur color="Black"/>
</dog>
<dog breed="Corgi>
 <id name="Jim"/>
 <fur color="Tricolor"/>
</dog>
<dog breed="Lab">
 <id name="Tony"/>
 <fur color="Golden"/>
</dog>

Let's say I want all of the dogs of breed "Lab".  Or all dogs who
are black.  Or the names of every Corgi.

1.  IMHO, the natural thing to do would be to use XPath/XQuery like
/[EMAIL PROTECTED]"Lab"].  Is there a way to do this with Castor (and other
libraries if necessary)?
2.  It looks like I can implement a FieldHandler as a custom getter.  Is
this commonly done or a best practice? ie
     Dog getDogByBreed(String breed) {...}
3.  If worst comes to worst, I can always brute-force walk the results.
     for(Dog d: dogs) {
       if(d.getBreed().equals("Lab")) {
         list.add(d);
       }
     }
4.  Or is there a way to do this in a mapping file?

Thanks!

Reply via email to