lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aneuryzma <patrick.divia...@gmail.com>
Subject Digester / Lucene: How to make the XML parser more filexible ?
Date Fri, 25 Feb 2011 08:54:47 GMT

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.

Mime
View raw message