public class StAXStreamBuilder
extends java.lang.Object
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.
Constructor and Description |
---|
StAXStreamBuilder() |
Modifier and Type | Method and Description |
---|---|
Document |
build(javax.xml.stream.XMLStreamReader reader)
This builds a document from the supplied
XMLStreamReader.
|
java.util.List<Content> |
buildFragments(javax.xml.stream.XMLStreamReader reader,
StAXFilter filter)
Read the entire XMLStreamReader and from it build a list of Content that
conforms to the rules in the supplied StAXFilter.
|
Content |
fragment(javax.xml.stream.XMLStreamReader reader)
Read the current XML Fragment from the XMLStreamReader.
|
JDOMFactory |
getFactory()
Returns the current
JDOMFactory in use. |
void |
setFactory(JDOMFactory factory)
This sets a custom JDOMFactory for the builder.
|
public JDOMFactory getFactory()
JDOMFactory
in use.public void setFactory(JDOMFactory factory)
factory
- JDOMFactory
to usepublic Document build(javax.xml.stream.XMLStreamReader reader) throws JDOMException
The JDOMContent will be built by the current JDOMFactory.
reader
- XMLStreamReader
to read fromDocument
resultant Document objectJDOMException
- when errors occur in parsingpublic java.util.List<Content> buildFragments(javax.xml.stream.XMLStreamReader reader, StAXFilter filter) throws JDOMException
reader
- The XMLStreamReader to parsefilter
- The Filter to use for the ContentJDOMException
- if there was a parsing problem.public Content fragment(javax.xml.stream.XMLStreamReader reader) throws JDOMException
reader
- The XMLStreamReader to read the next fragment fromJDOMException
- if there is an issue with the state of the
XMLStreamReader or some other issue with the processing.Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.