background image

Resources, Namespaces, and Errors

<< XMLOutputFactory | Using XMLStreamReader >>
<< XMLOutputFactory | Using XMLStreamReader >>
R
ESOURCES
, N
AMESPACES
,
AND
E
RRORS
91
prefixes and associate them with Namespace URIs. See the StAX specification
for a more information.
XMLEventFactory
New instances of the abstract class
XMLEventFactory
are created by calling the
newInstance()
method on the class. The static method
XMLEventFac-
tory.newInstance()
is then used to create a new factory instance. This factory
references the
javax.xml.stream.XMLEventFactory
property to instantiate the
factory. The algorithm used to obtain the instance is the same as for
XMLInput-
Factory
and
XMLOutputFactory
but references the
javax.xml.stream.XMLEv-
entFactory
system property.
There are no default properties for
XMLEventFactory
.
Resources, Namespaces, and Errors
The StAX specification handles resource allocation, attributes and namespace,
and errors and exceptions as described below.
Resource Resolution
The
XMLResolver
interface provides a means to set the method that resolves
resources during XML processing. An application sets the interface on
XMLIn-
putFactory
, which then sets the interface on all processors created by that fac-
tory instance.
Attributes and Namespaces
Attributes are reported by a StAX processor using lookup methods and strings in
the cursor interface and
Attribute
and
Namespace
events in the iterator inter-
face. Note here that namespaces are treated as attributes, although namespaces
are reported separately from attributes in both the cursor and iterator APIs. Note
also that namespace processing is optional for StAX processors. See the StAX
specification for complete information about namespace binding and optional
namespace processing.