maybe you should ask on the Digester list for advice....
simon
On Fri, Feb 25, 2011 at 9:54 AM, aneuryzma <patrick.diviacco@gmail.com> wrote:
>
> I'm using Apache Commons Digester together with Lucene to index a xml
> collection. Some fields in the colleciton are not always available. See
> example:
>
> <doc>
> ..
> <geo></geo>
> </doc>
>
> <doc>
> ..
> <geo>
> <latitude>2432</latitude>
> <longitude>2342</longitude>
> </geo>
> </doc>
>
> I'm now wondering how to avoid to get a NullPointerException but only
> execute the following lines if the geo tag is available...
>
> digester.addCallMethod("collection/doc/geo/latitude", "setLatitude",
> 0);
> digester.addCallMethod("collection/doc/geo/longitude",
> "setLongitude", 0);
>
>
>
> thanks
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Digester-Lucene-How-to-make-the-XML-parser-more-filexible-tp2573859p2573859.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
>
|