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, wait
getDocumentElement, getDocumentElement
protected 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
OMException
public 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 OMXMLParserWrapper
OMException
public void discard(OMContainer container) throws OMException
OMException
public String getText() throws OMException
OMException
public String getNamespace() throws OMException
OMException
public int getNamespaceCount() throws OMException
OMException
public String getNamespacePrefix(int index) throws OMException
index
- OMException
public String getNamespaceUri(int index) throws OMException
index
- OMException
public void setCache(boolean b)
setCache
in interface OMXMLParserWrapper
b
- public boolean isCache()
isCache
in interface OMXMLParserWrapper
public String getName() throws OMException
OMException
public String getPrefix() throws OMException
OMException
public int getAttributeCount() throws OMException
OMException
public String getAttributeNamespace(int arg) throws OMException
arg
- OMException
public String getAttributeName(int arg) throws OMException
arg
- OMException
public String getAttributePrefix(int arg) throws OMException
arg
- OMException
public 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 OMXMLParserWrapper
XMLStreamReader
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 OMXMLParserWrapper
protected abstract OMNode createOMElement() throws OMException
OMException
public abstract int next() throws OMException
next
in interface OMXMLParserWrapper
OMException
public CustomBuilder registerCustomBuilder(QName qName, int maxDepth, CustomBuilder customBuilder)
CustomBuilderSupport
registerCustomBuilder
in interface CustomBuilderSupport
maxDepth
- indicate the maximum depth that this qname will be found. (root = 0)public CustomBuilder registerCustomBuilderForPayload(CustomBuilder customBuilder)
CustomBuilderSupport
registerCustomBuilderForPayload
in interface CustomBuilderSupport
protected CustomBuilder getCustomBuilder(String namespace, String localPart)
namespace
- localPart
- public short getBuilderType()
OMXMLParserWrapper
OMConstants.PUSH_TYPE_BUILDER
or OMConstants.PULL_TYPE_BUILDER
.getBuilderType
in interface OMXMLParserWrapper
public void registerExternalContentHandler(Object obj)
registerExternalContentHandler
in interface OMXMLParserWrapper
obj
- public Object getRegisteredContentHandler()
getRegisteredContentHandler
in interface OMXMLParserWrapper
protected abstract OMDocument createDocument()
protected void createDocumentIfNecessary()
public OMDocument getDocument()
OMXMLParserWrapper
getDocument
in interface OMXMLParserWrapper
OMDocument
instancepublic String getCharsetEncoding()
public void close()
OMXMLParserWrapper
close
in interface OMXMLParserWrapper
public Object getReaderProperty(String name) throws IllegalArgumentException
name
- IllegalArgumentException
public String getCharacterEncoding()
getCharacterEncoding
in interface OMXMLParserWrapper
public void setAutoClose(boolean autoClose)
autoClose
- public boolean isClosed()
public void releaseParserOnClose(boolean value)
public void detach() throws OMException
OMXMLParserWrapper
OMXMLBuilderFactory
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 OMXMLParserWrapper
OMException
Copyright © The Apache Software Foundation. All Rights Reserved.