public abstract class StAXBuilder extends Object implements OMXMLParserWrapper
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_isClosed |
protected boolean |
_releaseParserOnClose |
protected boolean |
cache
Field cache
|
protected String |
charEncoding |
protected CustomBuilder |
customBuilderForPayload |
protected Map |
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
Element level is the depth of the element.
|
protected OMNode |
lastNode
Field lastNode
|
protected int |
maxDepthForCustomBuilders |
protected OMFactory |
omfactory
Field omfactory
|
protected XMLStreamReader |
parser
Field parser
|
protected boolean |
parserAccessed
Field parserAccessed
|
protected Exception |
parserException
Stores exceptions thrown by the parser.
|
| Modifier | Constructor and Description |
|---|---|
protected |
StAXBuilder()
Init() *must* be called after creating the builder using this constructor.
|
protected |
StAXBuilder(OMFactory ombuilderFactory,
XMLStreamReader parser)
Constructor StAXBuilder.
|
protected |
StAXBuilder(OMFactory ombuilderFactory,
XMLStreamReader parser,
String characterEncoding)
Constructor StAXBuilder.
|
protected |
StAXBuilder(XMLStreamReader parser)
Constructor StAXBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this builder.
|
protected abstract OMNode |
createOMElement()
This method is called with the XMLStreamConstants.START_ELEMENT event.
|
protected OMNode |
createOMText(int textType)
Method createOMText.
|
void |
discard(OMElement element)
Method discard.
|
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.
|
OMNode |
getLastNode() |
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/WSCOMMONS-155
|
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.
|
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)
Indicate if the parser resource should be release when closed.
|
void |
reset(OMNode node)
Method reset.
|
void |
setCache(boolean b)
Method setCache.
|
void |
setOMBuilderFactory(OMFactory ombuilderFactory)
Method setOMBuilderFactory.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDocumentElement, getDocumentElementprotected XMLStreamReader parser
protected OMFactory omfactory
protected OMNode lastNode
protected boolean done
protected boolean cache
protected boolean parserAccessed
protected OMDocument document
protected String charEncoding
protected boolean _isClosed
protected boolean _releaseParserOnClose
protected CustomBuilder customBuilderForPayload
protected Map 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
protected Exception parserException
protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser)
ombuilderFactory - parser - protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser, String characterEncoding)
ombuilderFactory - parser - characterEncoding - protected StAXBuilder(XMLStreamReader parser)
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) throws OMException
OMExceptionpublic void reset(OMNode node) throws OMException
node - OMExceptionpublic void discard(OMElement element) throws OMException
discard in interface OMXMLParserWrapperelement - 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 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)
qName - maxDepth - indicate the maximum depth that this qname will be found. (root = 0)customBuilder - public CustomBuilder registerCustomBuilderForPayload(CustomBuilder customBuilder)
customBuilder - protected 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 OMXMLParserWrapperpublic OMDocument getDocument()
OMXMLParserWrappergetDocument in interface OMXMLParserWrapperOMDocument instancepublic String getCharsetEncoding()
public OMNode getLastNode()
public void close()
OMXMLParserWrapperclose in interface OMXMLParserWrapperpublic Object getReaderProperty(String name) throws IllegalArgumentException
name - IllegalArgumentExceptionpublic String getCharacterEncoding()
getCharacterEncoding in interface OMXMLParserWrapperpublic boolean isClosed()
public void releaseParserOnClose(boolean value)
value - booleanCopyright © 2004–2016 The Apache Software Foundation. All rights reserved.