I came across two different codes for parsing a file with StAX. A quick googling told me that there are 2 ways to parse : using cursor API and using iterator API. Please tell me the difference between the two and which one is easier to use from developer point of view.
I came across two different codes for parsing a file with StAX . A
Share
You’re most likely to find the answer in the StAX API sections within the Java Web Services Developer Pack tutorial or Java EE 5 tutorial. Both of them contain the same information that I am reproducing below:
The iterator API although recommended is slower than the cursor API, as the cursor does not need to remember the previous nodes that it had parsed; it provides forward-only parsing of XML documents and does not have the overhead of construction of
XMLEventobjects. Apparently, a benchmark has indicated that SAX might turn out to be better at parsing large documents compared to StAX; you might want to verify if you can reproduce the results of the benchmark for your data-sets.