I have some very simple XML that I wish to unmarshall. I'm only interested in the values for one of the elements which repeats. Here's some sample XML:



<Document>
<HeaderGuff>Whatever</HeaderGuff>
<Foos>
<FooId>1</FooId>
<FooId>2</FooId>
</Foos>
</Document>


I would like to use JAXB to allow me to iterate of the FooId's as a Long.


The usual examples require creating a data class with setFooId and getFooId methods. Is there a way to unmarshall directly to Long such that I can do this:



for ( Long fooId : <something JAXB> )


I do not want to load all the identifiers into memory at once as there are potentially many of them, and they are only needed one at a time for individual processing.


No comments:

Post a Comment