because I got big xml-files I am using streaming/event style to parse xml entries and let them later transform to jaxb-objects.
a simplified xml example:
here i only want to receive an event for users who are aktive="true".
for that a lookahead would be necessary, but is such a lookahead possible with xml parsing in stream/event style (when getting a start-element-event it does not know about children elements, which is against the "nature" of streaming)?
The simplest thing to do would be to start storing data in a new object when you hit a new user but discard it if active.equals("false"). If your custom object implemented a clear() method this would not involve excess object creation.
Exactly why do you feel JAXB is what you need? (just curious)
yes, that is what i am exactly doing right now (loading complete jaxb object and the query java style and filter it afterward)
but i was just interested whether such a lookahead is possible, because it happens quite often that you need some information of xml-children nodes when working on the events and don't want to unnecessarily parse to jaxb objects.
the jaxb-stream style works quite well on my machine. having a monster export file (~900MB) and iterating ~200K items takes only 90 seconds.
reason i used jaxb:
-quite big and complicated schema (couldn't bother to fiddle around with xpath or other queries)
-i need to traverse a lot of data from one xml entry inside java
-xjc to generate jaxb-classes out from xsd was quite smooth