XMLStreamReaders are pre-configured and as a result JDOM is not able to alter whether the input is validated, or whether the Stream has 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 | builderfactory
The factory to use for parsing |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Document | Returns: Document resultant Document objectXMLStreamReader to read fromThis builds a document from the supplied XMLStreamReader. |
| public List | Returns: a List of Content that were identified by the supplied filterThe XMLStreamReader to parse reader, StAXFilter The Filter to use for the Content filter)Read the entire XMLStreamReader and from it build a list of Content that conforms to the rules in the supplied StAXFilter. |
| public Content | Returns: The JDOM fragment at the current position in the readerThe XMLStreamReader to read the next fragment from reader)Read the current XML Fragment from the XMLStreamReader. |
| public JDOMFactory | |
| private static final Document | Returns: the parsed DocumentThe factory, final XMLStreamReader JDOMFactory to useThe XMLStreamReader to read from stream)Create a Document from an XMLStreamReader |
| private static final Element | |
| private static final Element | |
| private static final Content | Returns: the parsed DocumentThe factory, final XMLStreamReader JDOMFactory to useThe XMLStreamReader to read from stream)Create a Content from an XMLStreamReader The stream is advanced to the event after the current event (or to the event after the matching END_ELEMENT for an Element fragment). |
| private List | |
| private static final Element | processPrunableElement(final JDOMFactory factory, final XMLStreamReader reader, final int topdepth, StAXFilter filter)
|
| public void |
| builderfactory | back to summary |
|---|---|
| private JDOMFactory builderfactory The factory to use for parsing | |
| StAXStreamBuilder | back to summary |
|---|---|
| public StAXStreamBuilder() | |
| build | back to summary |
|---|---|
| public Document build(XMLStreamReader reader) throws JDOMException This builds a document from the supplied XMLStreamReader. The JDOMContent will be built by the current JDOMFactory.
| |
| buildFragments | back to summary |
|---|---|
| public List Read the entire XMLStreamReader and from it build a list of Content that conforms to the rules in the supplied StAXFilter.
| |
| fragment | back to summary |
|---|---|
| public Content fragment(XMLStreamReader reader) throws JDOMException Read the current XML Fragment from the XMLStreamReader. The XMLStreamReader must be at some 'content' state, it cannot be at START_DOCUMENT, for example.
| |
| getFactory | back to summary |
|---|---|
| public JDOMFactory getFactory() Returns the current
| |
| process | back to summary |
|---|---|
| private static final Document process(final JDOMFactory factory, final XMLStreamReader stream) throws JDOMException Create a Document from an XMLStreamReader
| |
| processElement | back to summary |
|---|---|
| private static final Element processElement(final JDOMFactory factory, final XMLStreamReader reader) | |
| processElementFragment | back to summary |
|---|---|
| private static final Element processElementFragment(final JDOMFactory factory, final XMLStreamReader reader) throws XMLStreamException, JDOMException | |
| processFragment | back to summary |
|---|---|
| private static final Content processFragment(final JDOMFactory factory, final XMLStreamReader stream) throws JDOMException Create a Content from an XMLStreamReader The stream is advanced to the event after the current event (or to the event after the matching END_ELEMENT for an Element fragment).
| |
| processFragments | back to summary |
|---|---|
| private List | |
| processPrunableElement | back to summary |
|---|---|
| private static final Element processPrunableElement(final JDOMFactory factory, final XMLStreamReader reader, final int topdepth, StAXFilter filter) throws XMLStreamException, JDOMException | |
| 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.
| |