Package org.apache.axiom.om.impl
Class OMStAXWrapper
- java.lang.Object
-
- javax.xml.stream.util.StreamReaderDelegate
-
- org.apache.axiom.om.impl.OMStAXWrapper
-
- All Implemented Interfaces:
XMLStreamConstants,XMLStreamReader,OMAttachmentAccessor,OMXMLStreamReader
public class OMStAXWrapper extends StreamReaderDelegate implements OMXMLStreamReader
XMLStreamReaderimplementation that generates events from a given Axiom tree. This class does intentionally does not implement XMLStreamReaderContainer because it does not wrap a parser (it wraps an OM graph).
-
-
Field Summary
-
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
-
-
Constructor Summary
Constructors Constructor Description OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode)When constructing the OMStaxWrapper, the creator must produce the builder (an instance of the OMXMLparserWrapper of the input) and the Element Node to start parsing.OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache)Constructor OMStAXWrapper.OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache, boolean preserveNamespaceContext)Constructor OMStAXWrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenableDataSourceEvents(boolean value)If enabled, treat OMSourcedElements that have a OMDataSource as leaf nodes.OMXMLParserWrappergetBuilder()DataHandlergetDataHandler(String contentID)OMDataSourcegetDataSource()booleanisAllowSwitching()booleanisClosed()booleanisInlineMTOM()By default, an OMText item that has an MTOM datahandler will be rendered as a inlined text event.voidreleaseParserOnClose(boolean value)voidsetAllowSwitching(boolean b)voidsetInlineMTOM(boolean value)voidsetNamespaceURIInterning(boolean b)voidsetParser(XMLStreamReader parser)-
Methods inherited from class javax.xml.stream.util.StreamReaderDelegate
close, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getElementText, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getParent, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasNext, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, next, nextTag, require, setParent, standaloneSet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.xml.stream.XMLStreamReader
close, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getElementText, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasNext, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, next, nextTag, require, standaloneSet
-
-
-
-
Constructor Detail
-
OMStAXWrapper
public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode)
When constructing the OMStaxWrapper, the creator must produce the builder (an instance of the OMXMLparserWrapper of the input) and the Element Node to start parsing. The wrapper will parse(proceed) until the end of the given element. Hence care should be taken to pass the root element if the entire document is needed.- Parameters:
builder-startNode-
-
OMStAXWrapper
public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache)
Constructor OMStAXWrapper.- Parameters:
builder-startNode-cache-
-
OMStAXWrapper
public OMStAXWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache, boolean preserveNamespaceContext)
Constructor OMStAXWrapper.- Parameters:
builder-startNode-cache-preserveNamespaceContext-
-
-
Method Detail
-
isInlineMTOM
public boolean isInlineMTOM()
Description copied from interface:OMXMLStreamReaderBy default, an OMText item that has an MTOM datahandler will be rendered as a inlined text event.- Specified by:
isInlineMTOMin interfaceOMXMLStreamReader- Returns:
- true if inlined as TEXT, false if XOP_INCLUDE is used
-
setInlineMTOM
public void setInlineMTOM(boolean value)
- Specified by:
setInlineMTOMin interfaceOMXMLStreamReader- Parameters:
value- set to true if inlining of text is desired (default) throw OMException if not the value is not supported.
-
getDataHandler
public DataHandler getDataHandler(String contentID)
- Specified by:
getDataHandlerin interfaceOMAttachmentAccessor- Parameters:
contentID- (without the surrounding angle brackets and "cid:" prefix)- Returns:
- The DataHandler of the mime part referred by the Content-Id or *null* if the mime part referred by the content-id does not exist
-
getBuilder
public OMXMLParserWrapper getBuilder()
-
isAllowSwitching
public boolean isAllowSwitching()
-
isClosed
public boolean isClosed()
-
releaseParserOnClose
public void releaseParserOnClose(boolean value)
-
setAllowSwitching
public void setAllowSwitching(boolean b)
-
setParser
public void setParser(XMLStreamReader parser)
-
setNamespaceURIInterning
public void setNamespaceURIInterning(boolean b)
-
getDataSource
public OMDataSource getDataSource()
- Returns:
- OMDataSource if available
-
enableDataSourceEvents
public void enableDataSourceEvents(boolean value)
If enabled, treat OMSourcedElements that have a OMDataSource as leaf nodes. The caller should use the getDataSource method to obtain the OMDataSource for these events.- Parameters:
value- boolean
-
-