Table of Contents
Axiom is tightly integrated with StAX and the
getXMLStreamReader()
and getXMLStreamReaderWithoutCaching()
methods in the
OMElement
provides a XMLStreamReader
object. This XMLStreamReader
instance
has a special capability of switching between the underlying stream and the
Axiom object tree if the cache setting is off. However, this functionality is
completely transparent to the user. This is further explained in the
following paragraphs.
Axiom has the concept of caching, and the Axiom tree is the actual cache of the events
fired. However, the requester can choose to get the pull events from the
underlying stream rather than the Axiom tree. This can be achieved by getting
the pull parser with the cache off. If the pull parser was obtained without
switching off cache, the new events fired will be cached and the tree
updated. This returned pull parser will switch between the object structure
and the stream underneath, and the users need not worry about the differences
caused by the switching. The exact pull stream the original document would
have provided would be produced even if the Axiom tree was fully or partially
built. The getXMLStreamReaderWithoutCaching()
method is very useful when the
events need to be handled in a pull based manner without any intermediate
models. This makes such operations faster and efficient.
![]() | |
For consistency reasons once the cache is switched off it cannot be switched on again. |