XMLEventReaders are pre-configured and as a result JDOM is not able to alter whether the input is validated, or whether the Events have escaped entities or not. These (and other) characteristics are configurable by setting the correct features and properties on the XMLInputFactory when it is used to create the XMLStreamReader.
Useful configuration to set, or know about is:
http://java.sun.com/xml/stream/properties/report-cdata-event
for the default Java StAX implementation, or the equivalent property for your
StAX engine.
From a JDOM perspective XMLStreamReaders are more efficient than XMLEventReaders. Where possible use an XMLStreamReader.
If you happen to be looking at the source code, pay careful attention to the imports so you know what type of instance is being processed, whether it is a StAX class, or a JDOM class, because there are name conflicts.
| Modifier and Type | Field and Description |
|---|---|
| private JDOMFactory | factory
The factory to use for parsing |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Document | Returns: Document resultant Document objectXMLEventReader to read fromThis builds a document from the supplied XMLEventReader. |
| public JDOMFactory | |
| private static final Document | Returns: the parsed Documentthe factory, final XMLEventReader JDOMFactory to usethe XMLEventReader to read from events)Create a Document from an XMLEventReader |
| private static final Element | |
| public void |
| factory | back to summary |
|---|---|
| private JDOMFactory factory The factory to use for parsing | |
| StAXEventBuilder | back to summary |
|---|---|
| public StAXEventBuilder() | |
| build | back to summary |
|---|---|
| public Document build(XMLEventReader events) throws JDOMException This builds a document from the supplied XMLEventReader. The JDOMContent will be built by the current JDOMFactory.
| |
| getFactory | back to summary |
|---|---|
| public JDOMFactory getFactory() Returns the current
| |
| process | back to summary |
|---|---|
| private static final Document process(final JDOMFactory factory, final XMLEventReader events) throws JDOMException Create a Document from an XMLEventReader
| |
| processElement | back to summary |
|---|---|
| private static final Element processElement(final JDOMFactory factory, final StartElement event) | |
| setFactory | back to summary |
|---|---|
| public void setFactory(JDOMFactory factory) This sets a custom JDOMFactory for the builder. Use this to build the tree with your own subclasses of the JDOM classes.
| |