Java Reference
In-Depth Information
START_ELEMENT
Qname = article
START_ELEMENT
Qname = abstract
START_ELEMENT
Qname = code-inline
END_ELEMENT
Qname = code-inline
END_ELEMENT
Qname = abstract
START_ELEMENT
Qname = body
END_ELEMENT
Qname = body
END_ELEMENT
Qname = article
Note
You can also create a filtered event-based reader to accept or reject various
events by calling one of
XMLInputFactory
's
createFilteredReader()
methods, such as
XMLEventReader createFilteredRead-
er(XMLEventReader reader, EventFilter filter)
. The
javax.stream.xml.EventFilter
interface declares a
boolean ac-
cept(XMLEvent event)
methodthatreturnstruewhenthespecifiedeventispart
of the event sequence; otherwise, it returns false.
Creating XML Documents
Document writers are obtained by calling the various “
create
” methods that are de-
clared in the
javax.xml.stream.XMLOutputFactory
class. These creational
methods are organized into two categories: methods for creating stream-based writers
and methods for creating event-based writers.
Beforeyoucanobtainastream-basedoranevent-basedwriter,youneedtoobtainan
instance of the factory by calling one of the
newFactory()
class methods, such as
XMLOutputFactory newFactory()
:
XMLOutputFactory xmlof = XMLOutputFactory.newFactory();