Package org.apache.axiom.util.stax
Class WrappedTextNodeStreamReader
java.lang.Object
org.apache.axiom.util.stax.WrappedTextNodeStreamReader
- All Implemented Interfaces:
XMLStreamConstants,XMLStreamReader
XMLStreamReader implementation that
represents a text node wrapped inside an element. The text data is provided by a
Reader.
It will produce the following sequence of XML events:
- START_DOCUMENT
- START_ELEMENT
- (CHARACTER)*
- END_ELEMENT
- END_DOCMENT
START_DOCUMENT and the
following transitions are triggered by next():
- START_DOCUMENT → START_ELEMENT
- START_ELEMENT → END_ELEMENT (if character stream is empty)
- START_ELEMENT → CHARACTERS (if character stream is not empty)
- CHARACTERS → CHARACTERS (if data available in stream)
- CHARACTERS → END_ELEMENT (if end of stream reached)
- END_ELEMENT → END_DOCUMENT
getElementText() triggers the following transition:
- START_ELEMENT → END_ELEMENT
-
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
ConstructorsConstructorDescriptionWrappedTextNodeStreamReader(QName wrapperElementName, Reader reader) Create a new instance with chunk size 4096.WrappedTextNodeStreamReader(QName wrapperElementName, Reader reader, int chunkSize) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intgetAttributeLocalName(int index) getAttributeName(int index) getAttributeNamespace(int index) getAttributePrefix(int index) getAttributeType(int index) getAttributeValue(int index) getAttributeValue(String namespaceURI, String localName) intgetName()intgetNamespacePrefix(int index) getNamespaceURI(int index) getNamespaceURI(String prefix) getProperty(String name) getText()char[]intgetTextCharacters(int sourceStart, char[] target, int targetStart, int length) intintbooleanhasName()booleanhasNext()booleanhasText()booleanisAttributeSpecified(int index) booleanbooleanbooleanbooleanbooleanintnext()intnextTag()voidboolean
-
Constructor Details
-
WrappedTextNodeStreamReader
Create a new instance.- Parameters:
wrapperElementName- the qualified name of the wrapper elementreader- the Reader object holding the character data to be wrappedchunkSize- the maximum number of characters that are returned for each CHARACTER event
-
WrappedTextNodeStreamReader
Create a new instance with chunk size 4096.- Parameters:
wrapperElementName- the qualified name of the wrapper elementreader- the Reader object holding the character data to be wrapped
-
-
Method Details
-
getProperty
- Specified by:
getPropertyin interfaceXMLStreamReader- Throws:
IllegalArgumentException
-
hasNext
- Specified by:
hasNextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
next
- Specified by:
nextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
nextTag
- Specified by:
nextTagin interfaceXMLStreamReader- Throws:
XMLStreamException
-
getEventType
public int getEventType()- Specified by:
getEventTypein interfaceXMLStreamReader
-
isStartElement
public boolean isStartElement()- Specified by:
isStartElementin interfaceXMLStreamReader
-
isEndElement
public boolean isEndElement()- Specified by:
isEndElementin interfaceXMLStreamReader
-
isCharacters
public boolean isCharacters()- Specified by:
isCharactersin interfaceXMLStreamReader
-
isWhiteSpace
public boolean isWhiteSpace()- Specified by:
isWhiteSpacein interfaceXMLStreamReader
-
hasText
public boolean hasText()- Specified by:
hasTextin interfaceXMLStreamReader
-
hasName
public boolean hasName()- Specified by:
hasNamein interfaceXMLStreamReader
-
require
- Specified by:
requirein interfaceXMLStreamReader- Throws:
XMLStreamException
-
getLocation
- Specified by:
getLocationin interfaceXMLStreamReader
-
close
- Specified by:
closein interfaceXMLStreamReader- Throws:
XMLStreamException
-
getEncoding
- Specified by:
getEncodingin interfaceXMLStreamReader
-
getCharacterEncodingScheme
- Specified by:
getCharacterEncodingSchemein interfaceXMLStreamReader
-
getVersion
- Specified by:
getVersionin interfaceXMLStreamReader
-
standaloneSet
public boolean standaloneSet()- Specified by:
standaloneSetin interfaceXMLStreamReader
-
isStandalone
public boolean isStandalone()- Specified by:
isStandalonein interfaceXMLStreamReader
-
getNamespaceContext
- Specified by:
getNamespaceContextin interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceXMLStreamReader
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCountin interfaceXMLStreamReader
-
getAttributeName
- Specified by:
getAttributeNamein interfaceXMLStreamReader
-
getAttributeLocalName
- Specified by:
getAttributeLocalNamein interfaceXMLStreamReader
-
getAttributePrefix
- Specified by:
getAttributePrefixin interfaceXMLStreamReader
-
getAttributeNamespace
- Specified by:
getAttributeNamespacein interfaceXMLStreamReader
-
getAttributeType
- Specified by:
getAttributeTypein interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceXMLStreamReader
-
isAttributeSpecified
public boolean isAttributeSpecified(int index) - Specified by:
isAttributeSpecifiedin interfaceXMLStreamReader
-
getName
- Specified by:
getNamein interfaceXMLStreamReader
-
getLocalName
- Specified by:
getLocalNamein interfaceXMLStreamReader
-
getPrefix
- Specified by:
getPrefixin interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getNamespaceCount
public int getNamespaceCount()- Specified by:
getNamespaceCountin interfaceXMLStreamReader
-
getNamespacePrefix
- Specified by:
getNamespacePrefixin interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getElementText
- Specified by:
getElementTextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
getText
- Specified by:
getTextin interfaceXMLStreamReader
-
getTextCharacters
public char[] getTextCharacters()- Specified by:
getTextCharactersin interfaceXMLStreamReader
-
getTextStart
public int getTextStart()- Specified by:
getTextStartin interfaceXMLStreamReader
-
getTextLength
public int getTextLength()- Specified by:
getTextLengthin interfaceXMLStreamReader
-
getTextCharacters
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException - Specified by:
getTextCharactersin interfaceXMLStreamReader- Throws:
XMLStreamException
-
getPIData
- Specified by:
getPIDatain interfaceXMLStreamReader
-
getPITarget
- Specified by:
getPITargetin interfaceXMLStreamReader
-