public abstract class StAXBuilder extends Object implements OMXMLParserWrapper, CustomBuilderSupport
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_isClosed |
protected boolean |
cache
Field cache
|
protected String |
charEncoding |
protected CustomBuilder |
customBuilderForPayload |
protected Map<QName,CustomBuilder> |
customBuilders |
protected DataHandlerReader |
dataHandlerReader
Reference to the
DataHandlerReader extension of the parser, or null if
the parser doesn't support this extension. |
protected OMDocument |
document |
protected boolean |
done
Field done
|
protected int |
elementLevel
Tracks the depth of the node identified by
target. |
protected int |
maxDepthForCustomBuilders |
protected OMFactoryEx |
omfactory
Field omfactory
|
protected javax.xml.stream.XMLStreamReader |
parser
Field parser
|
protected boolean |
parserAccessed
Field parserAccessed
|
protected Exception |
parserException
Stores exceptions thrown by the parser.
|
protected OMContainerEx |
target
Field lastNode
|
| Modifier | Constructor and Description |
|---|---|
protected |
StAXBuilder()
Deprecated.
|
protected |
StAXBuilder(OMFactory omFactory,
javax.xml.stream.XMLStreamReader parser)
Deprecated.
|
protected |
StAXBuilder(OMFactory omFactory,
javax.xml.stream.XMLStreamReader parser,
Detachable detachable,
Closeable closeable)
For internal use only.
|
protected |
StAXBuilder(OMFactory omFactory,
javax.xml.stream.XMLStreamReader parser,
String encoding)
Deprecated.
|
protected |
StAXBuilder(OMFactory omFactory,
javax.xml.stream.XMLStreamReader parser,
String encoding,
Detachable detachable,
Closeable closeable)
For internal use only.
|
protected |
StAXBuilder(javax.xml.stream.XMLStreamReader parser)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this builder.
|
protected abstract OMDocument |
createDocument() |
protected void |
createDocumentIfNecessary() |
protected abstract OMNode |
createOMElement()
This method is called with the XMLStreamConstants.START_ELEMENT event.
|
protected OMNode |
createOMText(int textType)
This method will check whether the text can be optimizable using IS_BINARY flag.
|
void |
debugDiscarded(Object container)
For internal use only.
|
void |
detach()
Detach this builder from its underlying source, so that the state of the source object can be
changed without impact on the object model produced by this builder.
|
javax.xml.stream.XMLStreamReader |
disableCaching()
For internal use only.
|
void |
discard(OMContainer container) |
void |
discard(OMElement element) |
int |
getAttributeCount()
Method getAttributeCount.
|
String |
getAttributeName(int arg)
Method getAttributeName.
|
String |
getAttributeNamespace(int arg)
Method getAttributeNamespace.
|
String |
getAttributePrefix(int arg)
Method getAttributePrefix.
|
short |
getBuilderType()
Returns the type of the builder.
|
String |
getCharacterEncoding()
Returns the encoding style of the XML data
|
String |
getCharsetEncoding() |
protected CustomBuilder |
getCustomBuilder(String namespace,
String localPart)
Return CustomBuilder associated with the namespace/localPart
|
OMDocument |
getDocument()
Get the document being built by this builder.
|
String |
getName()
Method getName.
|
String |
getNamespace()
Method getNamespace.
|
int |
getNamespaceCount()
Method getNamespaceCount.
|
String |
getNamespacePrefix(int index)
Method getNamespacePrefix.
|
String |
getNamespaceUri(int index)
Method getNamespaceUri.
|
Object |
getParser()
Get the underlying
XMLStreamReader used by this builder. |
String |
getPrefix()
Method getPrefix.
|
Object |
getReaderProperty(String name)
Get the value of a feature/property from the underlying XMLStreamReader implementation
without accessing the XMLStreamReader. https://issues.apache.org/jira/browse/AXIOM-348
|
Object |
getRegisteredContentHandler()
Method getRegisteredContentHandler.
|
String |
getText()
Method getText.
|
void |
init(InputStream inputStream,
String charSetEncoding,
String url,
String contentType)
Deprecated.
Not used anywhere
|
boolean |
isCache() |
boolean |
isClosed() |
boolean |
isCompleted()
Method isCompleted.
|
abstract int |
next()
Forwards the parser one step further, if parser is not completed yet.
|
protected void |
processAttributes(OMElement node)
Method processAttributes.
|
protected abstract void |
processNamespaceData(OMElement node)
Method processNamespaceData.
|
void |
reenableCaching(OMContainer container)
For internal use only.
|
CustomBuilder |
registerCustomBuilder(QName qName,
int maxDepth,
CustomBuilder customBuilder)
Register a CustomBuilder associated with the indicated QName.
|
CustomBuilder |
registerCustomBuilderForPayload(CustomBuilder customBuilder)
Register a CustomBuilder for a payload.
|
void |
registerExternalContentHandler(Object obj)
Method registerExternalContentHandler.
|
void |
releaseParserOnClose(boolean value)
Deprecated.
As of Axiom 1.2.15, the builder always releases the parser.
|
void |
setAutoClose(boolean autoClose)
For internal use only.
|
void |
setCache(boolean b)
Method setCache.
|
void |
setOMBuilderFactory(OMFactory ombuilderFactory)
Method setOMBuilderFactory.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDocumentElement, getDocumentElementprotected javax.xml.stream.XMLStreamReader parser
protected OMFactoryEx omfactory
protected OMContainerEx target
protected boolean done
protected boolean cache
protected boolean parserAccessed
protected OMDocument document
protected String charEncoding
protected boolean _isClosed
protected CustomBuilder customBuilderForPayload
protected Map<QName,CustomBuilder> customBuilders
protected int maxDepthForCustomBuilders
protected DataHandlerReader dataHandlerReader
DataHandlerReader extension of the parser, or null if
the parser doesn't support this extension.protected int elementLevel
target. By definition, the level of the
root element is defined as 1. Note that if caching is disabled, then this depth may be
different from the actual depth reached by the underlying parser.protected Exception parserException
protected StAXBuilder(OMFactory omFactory, javax.xml.stream.XMLStreamReader parser, String encoding, Detachable detachable, Closeable closeable)
protected StAXBuilder(OMFactory omFactory, javax.xml.stream.XMLStreamReader parser, Detachable detachable, Closeable closeable)
protected StAXBuilder(OMFactory omFactory, javax.xml.stream.XMLStreamReader parser)
protected StAXBuilder(OMFactory omFactory, javax.xml.stream.XMLStreamReader parser, String encoding)
protected StAXBuilder(javax.xml.stream.XMLStreamReader parser)
protected StAXBuilder()
public void init(InputStream inputStream, String charSetEncoding, String url, String contentType) throws OMException
OMExceptionpublic void setOMBuilderFactory(OMFactory ombuilderFactory)
ombuilderFactory - protected abstract void processNamespaceData(OMElement node)
node - protected void processAttributes(OMElement node)
node - protected OMNode createOMText(int textType)
textType - public void debugDiscarded(Object container)
container - public void discard(OMElement element) throws OMException
discard in interface OMXMLParserWrapperOMExceptionpublic void discard(OMContainer container) throws OMException
OMExceptionpublic String getText() throws OMException
OMExceptionpublic String getNamespace() throws OMException
OMExceptionpublic int getNamespaceCount()
throws OMException
OMExceptionpublic String getNamespacePrefix(int index) throws OMException
index - OMExceptionpublic String getNamespaceUri(int index) throws OMException
index - OMExceptionpublic void setCache(boolean b)
setCache in interface OMXMLParserWrapperb - public boolean isCache()
isCache in interface OMXMLParserWrapperpublic String getName() throws OMException
OMExceptionpublic String getPrefix() throws OMException
OMExceptionpublic int getAttributeCount()
throws OMException
OMExceptionpublic String getAttributeNamespace(int arg) throws OMException
arg - OMExceptionpublic String getAttributeName(int arg) throws OMException
arg - OMExceptionpublic String getAttributePrefix(int arg) throws OMException
arg - OMExceptionpublic Object getParser()
XMLStreamReader used by this builder. Note that for this type of
builder, accessing the underlying parser implies that can no longer be used, and any attempt
to call next() will result in an exception.getParser in interface OMXMLParserWrapperXMLStreamReader object used by this builder. Note that the constraints
described in the Javadoc of the reader parameter of the
CustomBuilder.create(String, String, OMContainer, XMLStreamReader, OMFactory)
method also apply to the stream reader returned by this method, i.e.:
XOPUtils.getXOPEncodedStream(XMLStreamReader)
to get an XOP encoded stream from the return value.
XMLStreamReaderUtils.getOriginalXMLStreamReader(XMLStreamReader).
IllegalStateException - if the parser has already been accessedpublic javax.xml.stream.XMLStreamReader disableCaching()
public void reenableCaching(OMContainer container)
public boolean isCompleted()
isCompleted in interface OMXMLParserWrapperprotected abstract OMNode createOMElement() throws OMException
OMExceptionpublic abstract int next()
throws OMException
next in interface OMXMLParserWrapperOMExceptionpublic CustomBuilder registerCustomBuilder(QName qName, int maxDepth, CustomBuilder customBuilder)
CustomBuilderSupportregisterCustomBuilder in interface CustomBuilderSupportmaxDepth - indicate the maximum depth that this qname will be found. (root = 0)public CustomBuilder registerCustomBuilderForPayload(CustomBuilder customBuilder)
CustomBuilderSupportregisterCustomBuilderForPayload in interface CustomBuilderSupportprotected CustomBuilder getCustomBuilder(String namespace, String localPart)
namespace - localPart - public short getBuilderType()
OMXMLParserWrapperOMConstants.PUSH_TYPE_BUILDER
or OMConstants.PULL_TYPE_BUILDER.getBuilderType in interface OMXMLParserWrapperpublic void registerExternalContentHandler(Object obj)
registerExternalContentHandler in interface OMXMLParserWrapperobj - public Object getRegisteredContentHandler()
getRegisteredContentHandler in interface OMXMLParserWrapperprotected abstract OMDocument createDocument()
protected void createDocumentIfNecessary()
public OMDocument getDocument()
OMXMLParserWrappergetDocument in interface OMXMLParserWrapperOMDocument instancepublic String getCharsetEncoding()
public void close()
OMXMLParserWrapperclose in interface OMXMLParserWrapperpublic Object getReaderProperty(String name) throws IllegalArgumentException
name - IllegalArgumentExceptionpublic String getCharacterEncoding()
getCharacterEncoding in interface OMXMLParserWrapperpublic void setAutoClose(boolean autoClose)
autoClose - public boolean isClosed()
public void releaseParserOnClose(boolean value)
public void detach()
throws OMException
OMXMLParserWrapperOMXMLBuilderFactory to create
the builder:
| Source object type | Action performed by this method |
|---|---|
InputStream, Reader, StreamSource with InputStream or
Reader |
The remaining unprocessed content of the stream is read into memory so that it can be safely closed. Note that this method doesn't close the stream; this is the responsibility of the caller. |
StreamSource with system ID and no stream |
The remaining unprocessed content of the document is read into memory and the associated stream is closed. |
Node, DOMSource, SAXSource |
The object model is built completely. |
Attachments |
All MIME parts are fetched so that the stream from which the Attachments object
has been created can safely be closed. |
detach in interface OMXMLParserWrapperOMExceptionCopyright © The Apache Software Foundation. All Rights Reserved.