Results 1 to 1 of 1
- 02-25-2011, 08:44 AM #1
Member
- Join Date
- Aug 2008
- Posts
- 46
- Rep Power
- 0
Thread: Digester / Lucene: How to make the XML parser more filexible ?
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
Similar Threads
-
Digester parsing and Lucene indexing: empty index...
By aneuryzma in forum LuceneReplies: 0Last Post: 02-24-2011, 03:37 PM -
Make a thread Serializable
By madnaelo in forum Advanced JavaReplies: 2Last Post: 01-18-2011, 04:37 AM -
Parser API
By sruti_mohan in forum Advanced JavaReplies: 0Last Post: 06-09-2008, 07:23 AM -
JSP Parser????
By chathu03j in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 04-10-2008, 12:08 PM -
XML Parser
By samfuerte in forum XMLReplies: 1Last Post: 07-14-2007, 04:14 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks