java - Unmarshall single non-root node of a long XML file -
i have xml looks this:
<root> <header> ... </header> <entries> ... </entries> </root>
there single header node, lot of entries. there way extract node java bean, without reading whole xml file.
if possible, there support in springbatch or xstream?
i don't think using springbatch chunk-oriented tasklet staxeventitemreader
appropriate since want read 1 item.
you can write own itemreader extending staxeventitemreader (or, better, delegating it), redefine method itemreader.read()
, change condition indicate reader "exhausted" returning null after first valid node read: when spring-batch found itemreader.read()
method returning null
stop processing file.
can use chunk-oriented , avoid full file read.
Comments
Post a Comment