Top Description Fields Constructors Methods
com.ctc.wstx.sr

public abstract Class BasicStreamReader

extends StreamScanner
implements StreamReaderImpl, DTDInfo, LocationInfo
Class Inheritance
All Implemented Interfaces
org.codehaus.stax2.LocationInfo, org.codehaus.stax2.DTDInfo, com.ctc.wstx.sr.StreamReaderImpl, org.codehaus.stax2.XMLStreamReader2, org.codehaus.stax2.validation.Validatable, org.codehaus.stax2.typed.TypedXMLStreamReader, javax.xml.stream.XMLStreamReader, javax.xml.stream.XMLStreamConstants
Known Direct Subclasses
com.ctc.wstx.sr.TypedStreamReader
Imports
java.io.*, java.text.MessageFormat, java.util.Map, org.xml.sax.Attributes, .ContentHandler, .SAXException, org.xml.sax.ext.LexicalHandler, javax.xml.namespace.NamespaceContext, .QName, javax.xml.stream.Location, .XMLStreamException, org.codehaus.stax2.AttributeInfo, .DTDInfo, .LocationInfo, .XMLStreamLocation2, .XMLStreamReader2, org.codehaus.stax2.typed.TypedXMLStreamException, org.codehaus.stax2.validation.*, com.ctc.wstx.api.ReaderConfig, .WstxInputProperties, com.ctc.wstx.cfg.ErrorConsts, .XmlConsts, com.ctc.wstx.dtd.MinimalDTDReader, com.ctc.wstx.ent.EntityDecl, com.ctc.wstx.exc.WstxException, com.ctc.wstx.io.*, com.ctc.wstx.util.DefaultXmlSymbolTable, .ExceptionUtil, .TextBuffer, .TextBuilder

Partial implementation of XMLStreamReader2 consisting of all functionality other than DTD-validation-specific parts, and Typed Access API (Stax2 v3.0), which are implemented at sub-classes.
Author
Tatu Saloranta

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
private static final int
private static final int
protected static final int
protected static final int
MASK_GET_TEXT

This mask covers all types for which basic getText method can be called.

protected static final int
MASK_GET_TEXT_WITH_WRITER

This mask is used with Stax2 getText() method (one that takes Writer as an argument): accepts even wider range of event types.

protected static final int
MASK_GET_TEXT_XXX

This mask covers all types for which extends getTextXxx methods can be called; which is less than those for which getText can be called.

protected final AttributeCollector
mAttrCollector

Object that stores information about currently accessible attributes.

protected final boolean
protected final boolean
protected final boolean
protected int
mCheckIndentation

Counter used for determining whether we are to try to heuristically "intern" white space that seems to be used for indentation purposes

protected final int
mConfigFlags

Set of locally stored configuration flags

protected int
mCurrTextLength

Sized of currentTextLength for CDATA, CHARACTERS, WHITESPACE.

protected int
mCurrToken

Current state of the stream, ie token value returned by getEventType.

protected int
mDocStandalone

Status about "stand-aloneness" of document; set to 'yes'/'no'/'unknown' based on whether there was xml declaration, and if so, whether it had standalone attribute.

protected String
mDtdPublicId

Public id of the DTD, if one exists and has been parsed.

protected String
mDtdSystemId

System id of the DTD, if one exists and has been parsed.

protected final InputElementStack
mElementStack

Currently open element tree

protected Map<String, EntityDecl>
mGeneralEntities

Entities parsed from internal/external DTD subsets.

protected final ReaderCreator
mOwner

Object to notify about shared stuff, such as symbol tables, as well as to query for additional config settings if necessary.

protected int
mParseState

Main parsing/tokenization state (STATE_xxx)

protected XMLStreamException
mPendingException

Due to the way Stax API does not allow throwing stream exceptions from many methods for which Woodstox would need to throw one (especially getText and its variations), we may need to delay throwing an exception until next is called next time.

protected boolean
mReturnNullForDefaultNamespace

Configuration from WstxInputProperties#RETURN_NULL_FOR_DEFAULT_NAMESPACE

protected String
mRootLName

Local name of root element, as dictated by DOCTYPE declaration; null if no DOCTYPE declaration.

protected String
mRootPrefix

Prefix of root element, as dictated by DOCTYPE declaration; null if no DOCTYPE declaration, or no root prefix

protected int
mSecondaryToken

Additional information sometimes stored (when generating dummy events in multi-doc mode, for example) temporarily when mCurrToken is already populated.

protected final int
mShortestTextSegment

Minimum number of characters parser can return as partial text segment, IF it's not required to coalesce adjacent text segments.

protected boolean
protected boolean
protected final int
mStTextThreshold

Threshold value that defines tokenization state that needs to be achieved to "finish" current logical text segment (which may consist of adjacent CDATA and text segments; or be a complete physical segment; or just even a fragment of such a segment)

protected final TextBuffer
mTextBuffer

TextBuffer mostly used to collect non-element textual content (text, CDATA, comment content, pi data)

protected int
mTokenState

State of the current token; one of M_ - constants from above.

protected boolean
mValidateText

Flag that indicates that textual content (CDATA, CHARACTERS) is to be validated within current element's scope.

protected int
mVldContent

Mode information needed at this level; mostly to check what kind of textual content (if any) is allowed in current element context.

protected int
mWsStatus

Status of current (text) token's "whitespaceness", that is, whether it is or is not all white space.

protected static final String
protected static final String
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
Inherited from com.ctc.wstx.sr.StreamScanner:
CHAR_CR_LF_OR_NULLCHAR_FIRST_PURE_TEXTCHAR_LOWEST_LEGAL_LOCALNAME_CHARINT_CR_LF_OR_NULLmAllowXml11EscapedCharsInXml10mCachedEntitiesmCfgNsEnabledmCfgReplaceEntitiesmCfgTreatCharRefsAsEntitiesmConfigmCurrDepthmCurrEntitymCurrNamemDocInputEncodingmDocXmlEncodingmDocXmlVersionmEntityExpansionCountmEntityResolvermInputmInputTopDepthmNameBuffermNormalizeLFsmRootInputmSymbolsmTokenInputColmTokenInputRowmTokenInputTotal

Constructor Summary

AccessConstructor and Description
protected
BasicStreamReader(InputBootstrapper bs, BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg, InputElementStack
Input element stack to use; if null, will create instance locally.
elemStack
,
boolean
Override indicator; if true, this stream reader will be used by an event reader, and should modify some of the base config settings appropriately. If false, configuration settings are to be used as is.
forER
)

Method Summary

Modifier and TypeMethod and Description
private final char[]
_checkAttributeLimit(TextBuilder tb, char[] outBuf, int outPtr, int currAttrSize, int maxAttrSize)

protected TypedXMLStreamException
protected XMLStreamException
_constructUnexpectedInTyped(int nextToken)

Method called to report a problem with

private final char[]
_expandOutputForText(int inputPtr, char[] outBuf, int shortestSegment)

private final int
_outputLimit(char[] outBuf, int offset, int maxAttrLen)

protected void
private boolean

Returns:

True, if we hit the end marker; false if not.
checkCDataEnd
(char[] outBuf, int outPtr)

Method that will check, given the starting ']', whether there is ending ']]>' (including optional extra ']'s); if so, will updated output buffer with extra ]s, if not, will make sure input and output are positioned for further checking.

protected String

Returns:

Null, if keyword matches ok; String that contains erroneous keyword if not.
checkKeyword
(char c, String expected)

public void
close()

Implements javax.xml.stream.XMLStreamReader.close.

Note

as per StAX 1.0 specs, this method does NOT close the underlying input reader.

public void
closeCompletely()

Implements org.codehaus.stax2.XMLStreamReader2.closeCompletely.

Method similar to javax.xml.stream.XMLStreamReader#close, except that this method also does close the underlying input source if it has not yet been closed.

private int

Returns:

Event following end tag of the root elemennt, if any; END_DOCUMENT otherwis.e
closeContentTree
()

Method called when advancing stream past the end tag that closes the root element of the open document.

protected static InputElementStack
protected void
protected EntityDecl
findEntity(String
Identifier of the entity to find
id
,
Object
Optional argument passed from caller; needed by DTD reader.
arg
)

Implements abstract com.ctc.wstx.sr.StreamScanner.findEntity.

Abstract method for sub-classes to implement, for finding a declared general or parsed entity.

protected void
finishDTD(boolean
If true, will copy contents of the internal subset of DOCTYPE declaration in the text buffer; if false, will just completely ignore the subset (if one found).
copyContents
)

This method gets called to handle remainder of DOCTYPE declaration, essentially the optional internal subset.

protected void
finishToken(boolean
Flag to enable storing an exception to a variable, instead of immediately throwing it. If true, will just store the exception; if false, will not store, just throw.
deferErrors
)

Method called to read in contents of the token completely, if not yet read.

public void
public void
public void
public void
public void
public void
public AttributeCollector
getAttributeCollector()

Implements com.ctc.wstx.sr.StreamReaderImpl.getAttributeCollector.

Method needed by classes (like stream writer implementations) that want to have efficient direct access to attribute collector Object, for optimal attribute name and value access.

public int
getAttributeCount()

Implements javax.xml.stream.XMLStreamReader.getAttributeCount.

Returns the count of attributes on this START_ELEMENT, this method is only valid on a START_ELEMENT or ATTRIBUTE.

public AttributeInfo
getAttributeInfo()

Implements org.codehaus.stax2.XMLStreamReader2.getAttributeInfo.

Method that can be called to get additional information about attributes related to the current start element, as well as related DTD-based information if available.

public String
getAttributeLocalName(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.getAttributeLocalName.

Returns the localName of the attribute at the provided index

public QName
getAttributeName(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.getAttributeName.

Returns the qname of the attribute at the provided index

public String
getAttributeNamespace(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.getAttributeNamespace.

Returns the namespace of the attribute at the provided index

public String
getAttributePrefix(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.getAttributePrefix.

Returns the prefix of this attribute at the provided index

public String
getAttributeType(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.getAttributeType.

Returns the XML type of the attribute at the provided index

public String
getAttributeValue(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.getAttributeValue.

Returns the value of the attribute at the index

public String
getAttributeValue(String
the namespace of the attribute
nsURI
,
String
the local name of the attribute, cannot be null
localName
)

Implements javax.xml.stream.XMLStreamReader.getAttributeValue.

Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality

public String
getCharacterEncodingScheme()

Implements javax.xml.stream.XMLStreamReader.getCharacterEncodingScheme.

As per Stax (1.0) specs, needs to return whatever xml declaration claimed encoding is, if any; or null if no xml declaration found.

public EntityDecl
public int

Returns:

Number of open elements in the stack; 0 when parser is in prolog/epilog, 1 inside root element and so on.
getDepth
()

Implements org.codehaus.stax2.XMLStreamReader2.getDepth.

Method that returns the number of open elements in the stack; 0 when the reader is in prolog/epilog, 1 inside root element (including when pointing at the root element itself) and so on.

public DTDInfo
getDTDInfo()

Implements org.codehaus.stax2.XMLStreamReader2.getDTDInfo.

Since this class implements DTDInfo, method can just return this.

public String

Returns:

Internal subset portion of the DOCTYPE declaration, if any; empty String if none
getDTDInternalSubset
()

Implements org.codehaus.stax2.DTDInfo.getDTDInternalSubset.

private char[]
getDTDInternalSubsetArray()

Internal method used by implementation

public String
public String
public String
public String
getElementText()

Implements javax.xml.stream.XMLStreamReader.getElementText.

From StAX specs:

Reads the content of a text-only element, an exception is thrown if this is not a text-only element. Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content. Precondition: the current event is START_ELEMENT. Postcondition: the current event is the corresponding END_ELEMENT.
public String
getEncoding()

Implements javax.xml.stream.XMLStreamReader.getEncoding.

As per Stax (1.0) specs, needs to return whatever parser determined the encoding was, if it was able to figure it out.

public long
getEndingByteOffset()

Implements org.codehaus.stax2.LocationInfo.getEndingByteOffset.

Method that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event.

public long
getEndingCharOffset()

Implements org.codehaus.stax2.LocationInfo.getEndingCharOffset.

Method that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event.

public final XMLStreamLocation2
getEndLocation()

Implements org.codehaus.stax2.LocationInfo.getEndLocation.

An optional method that either returns the location object that points the ending position of the current event, or null if implementation does not keep track of it (some may return only start location; and some no location at all).

public int
getEventType()

Implements javax.xml.stream.XMLStreamReader.getEventType.

Returns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.

public Object
getFeature(String
Name of the feature of which value to get
name
)

Implements org.codehaus.stax2.XMLStreamReader2.getFeature.

Deprecated

Method that can be used to get per-reader values; both generic ones (names for which are defined as constants in this class), and implementation dependant ones.

public InputElementStack
getInputElementStack()

Implements com.ctc.wstx.sr.StreamReaderImpl.getInputElementStack.

Method needed by classes (like stream writer implementations) that want to have efficient direct access to element stack implementation

public String
getLocalName()

Implements javax.xml.stream.XMLStreamReader.getLocalName.

Returns the (local) name of the current event.

public final Location
public final LocationInfo
getLocationInfo()

Implements org.codehaus.stax2.XMLStreamReader2.getLocationInfo.

Location information is always accessible, for this reader.

public QName
getName()

Implements javax.xml.stream.XMLStreamReader.getName.

Returns a QName for the current START_ELEMENT or END_ELEMENT event

public NamespaceContext
getNamespaceContext()

Implements javax.xml.stream.XMLStreamReader.getNamespaceContext.

Returns a read only namespace context for the current position.

public int
getNamespaceCount()

Implements javax.xml.stream.XMLStreamReader.getNamespaceCount.

Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT, this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE.

public String
getNamespacePrefix(int
the position of the namespace declaration
index
)

Implements javax.xml.stream.XMLStreamReader.getNamespacePrefix.

Returns the prefix for the namespace declared at the index.

public String
getNamespaceURI()

Implements javax.xml.stream.XMLStreamReader.getNamespaceURI.

If the current event is a START_ELEMENT or END_ELEMENT this method returns the URI of the prefix or the default namespace.

public String
getNamespaceURI(int
the position of the namespace declaration
index
)

Implements javax.xml.stream.XMLStreamReader.getNamespaceURI.

Returns the uri for the namespace declared at the index.

public String
getNamespaceURI(String
The prefix to lookup, may not be null
prefix
)

Implements javax.xml.stream.XMLStreamReader.getNamespaceURI.

Return the uri for the given prefix.

public NamespaceContext
getNonTransientNamespaceContext()

Implements org.codehaus.stax2.XMLStreamReader2.getNonTransientNamespaceContext.

This method returns a namespace context object that contains information identical to that returned by javax.xml.stream.XMLStreamReader#getNamespaceContext(), but one that is not transient.

public String
getPIData()

Implements javax.xml.stream.XMLStreamReader.getPIData.

Get the data section of a processing instruction

public String
getPITarget()

Implements javax.xml.stream.XMLStreamReader.getPITarget.

Get the target of a processing instruction

public String
getPrefix()

Implements javax.xml.stream.XMLStreamReader.getPrefix.

Returns the prefix of the current event or null if the event does not have a prefix

public String
getPrefixedName()

Implements org.codehaus.stax2.XMLStreamReader2.getPrefixedName.

This method returns "prefix-qualified" name of the current element.

public Object
getProcessedDTD()

Implements org.codehaus.stax2.DTDInfo.getProcessedDTD.

Note

DTD-handling sub-classes need to override this method.

public DTDValidationSchema
getProcessedDTDSchema()

Implements org.codehaus.stax2.DTDInfo.getProcessedDTDSchema.

Sub-class will override this method

public Object
getProperty(String
The name of the property, may not be null
name
)

Implements javax.xml.stream.XMLStreamReader.getProperty.

Get the value of a feature/property from the underlying implementation

public long
getStartingByteOffset()

Implements org.codehaus.stax2.LocationInfo.getStartingByteOffset.

Method that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event.

public long
getStartingCharOffset()

Implements org.codehaus.stax2.LocationInfo.getStartingCharOffset.

Method that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event.

public String
getText()

Implements javax.xml.stream.XMLStreamReader.getText.

Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD.

public int

Returns:

Number of characters written to the reader
getText
(Writer
Writer to use for writing textual contents
w
,
boolean
If true, reader has to preserve contents so that further calls to getText will return proper conntets. If false, reader is allowed to skip creation of such copies: this can improve performance, but it also means that further calls to getText is not guaranteed to return meaningful data.
preserveContents
)

Implements org.codehaus.stax2.XMLStreamReader2.getText.

Method similar to getText(), except that it just uses provided Writer to write all textual content.

public char[]
getTextCharacters()

Implements javax.xml.stream.XMLStreamReader.getTextCharacters.

Returns an array which contains the characters from this event.

public int
getTextCharacters(int
the index of the first character in the source array to copy
sourceStart
,
char[]
the destination array
target
,
int
the start offset in the target array
targetStart
,
int
the number of characters to copy
len
)

Implements javax.xml.stream.XMLStreamReader.getTextCharacters.

Gets the text associated with a CHARACTERS, SPACE or CDATA event.

public int
getTextLength()

Implements javax.xml.stream.XMLStreamReader.getTextLength.

Returns the length of the sequence of characters for this Text event within the text character array.

public int
getTextStart()

Implements javax.xml.stream.XMLStreamReader.getTextStart.

Returns the offset into the text character array where the first character (of this text event) is stored.

public String
getVersion()

Implements javax.xml.stream.XMLStreamReader.getVersion.

Get the xml version declared on the xml declaration Returns null if none was declared

protected int
handleEOF(boolean isProlog)

private int

Returns:

Token to return
handleExtraRoot
(char
Character passed in (not currently used)
c
)

Method called if a root-level element is found after the main root element was closed.

protected void
handleGreedyEntityProblem(WstxInputSource input)

This problem gets reported if an entity tries to expand to a close tag matching start tag that did not came from the same entity (but from parent).

protected void
protected int

Returns:

Event type to return
handleMultiDocStart
(int nextEvent)

Method called when an event was encountered that indicates document boundary in multi-doc mode.

protected void
private final boolean

Returns:

True if this is an empty element; false if not
handleNonNsAttrs
(char c)

private final boolean

Returns:

True if this is an empty element; false if not
handleNsAttrs
(char c)

protected void
private final void
handleStartElem(char c)

Method that takes care of parsing of start elements; including full parsing of namespace declarations and attributes, as well as namespace resolution.

protected void
handleUndeclaredEntity(String id)

Implements abstract com.ctc.wstx.sr.StreamScanner.handleUndeclaredEntity.

This method gets called if a declaration for an entity was not found in entity expanding mode (enabled by default for xml reader, always enabled for dtd reader).

protected final boolean
hasConfigFlags(int flags)

public boolean
hasName()

Implements javax.xml.stream.XMLStreamReader.hasName.

returns a boolean indicating whether the current event has a name (is a START_ELEMENT or END_ELEMENT).

public boolean
hasNext()

Implements javax.xml.stream.XMLStreamReader.hasNext.

Returns true if there are more parsing events and false if there are no more events.

public boolean
hasText()

Implements javax.xml.stream.XMLStreamReader.hasText.

Return a boolean indicating whether the current event has text.

protected void
initValidation()

Method called right before the document root element is handled.

public boolean
isAttributeSpecified(int
the position of the attribute
index
)

Implements javax.xml.stream.XMLStreamReader.isAttributeSpecified.

Returns a boolean which indicates if this attribute was created by default

public boolean
isCharacters()

Implements javax.xml.stream.XMLStreamReader.isCharacters.

Returns true if the cursor points to a character data event

public boolean

Returns:

True, if cursor points to a start or end element that is constructed from 'empty' element (ends with '/>'); false otherwise.
isEmptyElement
()

Implements org.codehaus.stax2.XMLStreamReader2.isEmptyElement.

Method that can be used to check whether current START_ELEMENT event was created for an empty element (xml short-hand notation where one tag implies start and end, ending with "/>"), or not.

public boolean
isEndElement()

Implements javax.xml.stream.XMLStreamReader.isEndElement.

Returns true if the cursor points to an end tag (otherwise false)

public boolean
public boolean
isPropertySupported(String name)

Implements org.codehaus.stax2.XMLStreamReader2.isPropertySupported.

Method similar to javax.xml.stream.XMLInputFactory#isPropertySupported, used to determine whether a property is supported by the Reader instance.

public boolean
isStandalone()

Implements javax.xml.stream.XMLStreamReader.isStandalone.

Get the standalone declaration from the xml declaration

public boolean
isStartElement()

Implements javax.xml.stream.XMLStreamReader.isStartElement.

Returns true if the cursor points to a start tag (otherwise false)

public boolean
isWhiteSpace()

Implements javax.xml.stream.XMLStreamReader.isWhiteSpace.

05-Apr-2004, TSa: Could try to determine status when text is actually read.

public final int
next()

Implements javax.xml.stream.XMLStreamReader.next.

Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks.

private int
nextFromMultiDocState()

Method called to get the next event when we are "multi-doc hack" mode, during which extra END_DOCUMENT/START_DOCUMENT events need to be returned.

private boolean

Returns:

True if we hit EOI, false otherwise
nextFromProlog
(boolean isProlog)

Method called to find type of next token in prolog; either reading just enough information to know the type (lazy parsing), or the full contents (non-lazy)

private void
nextFromPrologBang(boolean isProlog)

Called after character sequence '<!' has been found; expectation is that it'll either be DOCTYPE declaration (if we are in prolog and haven't yet seen one), or a comment.

private final int
nextFromTree()

Method called to parse beginning of the next event within document tree, and return its type.

private int
nextFromTreeCommentOrCData()

Note

According to StAX 1.0, coalesced text events are always to be returned as CHARACTERS, never as CDATA.

public int
nextTag()

Implements javax.xml.stream.XMLStreamReader.nextTag.

Skips any white space (isWhiteSpace() returns true), COMMENT, or PROCESSING_INSTRUCTION, until a START_ELEMENT or END_ELEMENT is reached.

private final void
parseAttrValue(char
Quote character (single or double quote) for this attribute value
openingQuote
,
TextBuilder
TextBuilder into which attribute value will be added
tb
)

Method that will parse an attribute value enclosed in quotes, using an TextBuilder instance.

protected final void
parseQuoted(String name, char quoteChar, TextBuffer tbuf)

Method called to parse quoted xml declaration pseudo-attribute values.

private int

Returns:

Total number of characters written using the writer for the current CDATA event
readAndWriteCData
(Writer
Writer to use for writing out textual content parsed
w
)

Method called to read the contents of the current (possibly partially read) CDATA event, and write all contents using the specified Writer.

private int

Returns:

Number of characters written to Writer during the call
readAndWriteCoalesced
(Writer w, boolean wasCData)

private int

Returns:

Total number of characters written using the writer
readAndWriteText
(Writer
Writer to use for writing out textual content parsed
w
)

Method called to read the contents of the current CHARACTERS event, and write all contents using the specified Writer.

private final boolean

Returns:

True if the whole CDATA segment was completely read; this happens only if lt-char is hit; false if it's possible that it wasn't read (ie. end-of-buffer or entity encountered).
readCDataPrimary
(char
First character in the CDATA segment (possibly part of end marker for empty segments
c
)

Method called to read in consecutive beginning parts of a CDATA segment, up to either end of the segment (]] and >) or until first 'hole' in text (buffer end, 2-char lf to convert, entity).

protected boolean

Returns:

True if the whole CData section was completely read (we hit the end marker); false if a shorter segment was returned.
readCDataSecondary
(int shortestSegment)

protected void
readCoalescedText(int currType, boolean
Flag to enable storing an exception to a variable, instead of immediately throwing it. If true, will just store the exception; if false, will not store, just throw.
deferErrors
)

Method called to read the content of both current CDATA/CHARACTERS events, and all following consequtive events into the text buffer.

private void
private void
protected final void
readEndElem()

Method called to completely read a close tag, and update element stack appropriately (including checking that tag matches etc).

private final int

Returns:

-1, if the content was determined to be canonicalizable (indentation) white space; and thus fully parsed. Otherwise pointer (value to set to mInputPtr) to the next character to process (not processed by this method)
readIndentation
(char c, int ptr)

Method called to try to parse and canonicalize white space that has a good chance of being white space with somewhat regular structure; specifically, something that looks like typical indentation.

private void
readPI()

Method that parses a processing instruction's data portion; at this point target has been parsed.

private void
private final int

Returns:

Usually PROCESSING_INSTRUCTION; but may be different in multi-doc mode, if we actually hit a secondary xml declaration.
readPIPrimary
()

Method that reads the primary part of a PI, ie.

private final boolean

Returns:

True if the whole white space segment was read; false if something prevented that (end of buffer, replaceable 2-char lf)
readSpacePrimary
(char
First white space characters; known to contain white space at this point
c
,
boolean
If true, is reading white space outside XML tree, and as such can get EOF. If false, should not get EOF, nor be followed by any other char than <
prologWS
)

Reading whitespace should be very similar to reading normal text; although couple of simplifications can be made.

private void
readSpaceSecondary(boolean
True if the ignorable white space is within prolog (or epilog); false if it's within xml tree.
prologWS
)

This is very similar to readSecondaryText(); called when we need to read in rest of (ignorable) white space segment.

private final boolean

Returns:

True if the whole text segment was completely read; this happens only if lt-char is hit; false if it's possible that it wasn't read (ie. end-of-buffer or entity encountered).
readTextPrimary
(char
First character of the text segment
c
)

Method called to read in consecutive beginning parts of a text segment, up to either end of the segment (lt char) or until first 'hole' in text (buffer end, 2-char lf to convert, entity).

protected final boolean

Returns:

True if the text segment was completely read ('<' was hit, or in non-entity-expanding mode, a non-char entity); false if it may still continue
readTextSecondary
(int shortestSegment, boolean
Flag to enable storing an exception to a variable, instead of immediately throwing it. If true, will just store the exception; if false, will not store, just throw.
deferErrors
)

private void
protected void
reportInvalidContent(int
Type of event that contained unexpected content
evtType
)

Stub method implemented by validating parsers, to report content that's not valid for current element context.

private void
reportWrongEndElem(String prefix, String localName, int done)

private void
reportWrongEndPrefix(String prefix, String localName, int done)

public void
require(int
the event type
type
,
String
the uri of the event, may be null
nsUri
,
String
the localName of the event, may be null
localName
)

Implements javax.xml.stream.XMLStreamReader.require.

Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event.

protected void
protected void
public void
setFeature(String
Name of the feature to set
name
,
Object
Value to set feature to.
value
)

Implements org.codehaus.stax2.XMLStreamReader2.setFeature.

Deprecated

Method that can be used to set per-reader features such as configuration settings; both generic ones (names for which are defined as constants in this class), and implementation dependant ones.

public boolean

Returns:

True, if the specified property was succesfully set to specified value; false if its value was not changed
setProperty
(String
Name of the property to set
name
,
Object
Value to set property to.
value
)

Implements org.codehaus.stax2.XMLStreamReader2.setProperty.

Method that can be used to set per-reader properties; a subset of properties one can set via matching org.codehaus.stax2.XMLInputFactory2 instance.

public ValidationProblemHandler
setValidationProblemHandler(ValidationProblemHandler
Handler to install, if non null; if null, indicates that the default (implementation-specific) handling should be used
h
)

Implements org.codehaus.stax2.validation.Validatable.setValidationProblemHandler.

Method that application can call to define a custom handler for validation problems encountered during validation process.

private int

Returns:

Character following all the skipped text and CDATA segments, if any; or -1 to denote EOF
skipCoalescedText
(int i)

Method called to skip past all following text and CDATA segments, until encountering something else (including a general entity, which may in turn expand to text).

private void
skipCommentOrCData(String errorMsg, char endChar, boolean preventDoubles)

public void
skipElement()

Implements org.codehaus.stax2.XMLStreamReader2.skipElement.

Method that will skip all the contents of the element that the stream currently points to.

protected final char
skipEquals(String name, String eofMsg)

Method that checks that input following is of form '[S]* '=' [S]*' (as per XML specs, production #25).

private int

Returns:

Next character after node has been skipped, or -1 if EOF follows
skipToken
()

Method called to skip last part of current token, when full token has not been parsed.

private int
protected final boolean

Returns:

true If at least one white space was skipped; false if not (character passed was not white space)
skipWS
(char c)

Method that will skip any white space from input source(s)

public boolean
standaloneSet()

Implements javax.xml.stream.XMLStreamReader.standaloneSet.

Checks if standalone was set in the document

private void
startDTD()

Method called to parse through most of DOCTYPE declaration; excluding optional internal subset.

public XMLValidator
stopValidatingAgainst(XMLValidationSchema schema)

Implements org.codehaus.stax2.validation.Validatable.stopValidatingAgainst.

Method that can be called by application to stop validating output against a schema, for which validateAgainst was called earlier.

public XMLValidator
stopValidatingAgainst(XMLValidator validator)

Implements org.codehaus.stax2.validation.Validatable.stopValidatingAgainst.

Method that can be called by application to stop validating output using specified validator.

private void
throwNotTextual(int type)

protected void
private void
throwNotTextXxx(int type)

protected void
throwUnexpectedEOF()

Method called when we get an EOF within content tree

public XMLValidator
validateAgainst(XMLValidationSchema schema)

Implements org.codehaus.stax2.validation.Validatable.validateAgainst.

Method that will construct a XMLValidator instance from the given schema (unless a validator for that schema has already been added), initialize it if necessary, and make validatable object (reader, writer) call appropriate validation methods from this point on until the end of the document (that is, it's not scoped with sub-trees), or until validator is removed by an explicit call to stopValidatingAgainst.

public Object

Returns:

Null, if stream does not point to start element; whatever callback returns otherwise.
withStartElement
(ElemCallback cb, Location loc)

Implements com.ctc.wstx.sr.StreamReaderImpl.withStartElement.

Method called by com.ctc.wstx.evt.DefaultEventAllocator to get double-indirection necessary for constructing start element events.

Inherited from com.ctc.wstx.sr.StreamScanner:
_reportProblem_reportProblemcloseAllInputconstructFromIOEconstructLimitViolationconstructNullCharExceptionconstructWfcExceptionensureInputexpandBy50PctexpandEntityfullyResolveEntitygetConfiggetCurrentInputgetCurrentLocationgetIntEntitygetLastCharLocationgetNameBuffergetNextgetNextAfterWSgetNextChargetNextCharAfterWSgetNextCharFromCurrentgetNextInCurrAfterWSgetNextInCurrAfterWSgetSourcegetStartLocationgetSystemIdinitInputSourceinputInBufferloadMoreloadMoreloadMoreFromCurrentloadMoreFromCurrentmarkLFmarkLFparseEntityNameparseFNameForErrorparseFullNameparseFullNameparseFullName2parseLocalNameparseLocalName2parsePublicIdparseSystemIdparseUntilpeekNextpushbackreportProblemreportProblemreportValidationProblemreportValidationProblemreportValidationProblemreportValidationProblemreportValidationProblemresolveCharOnlyEntityresolveNonCharEntityresolveSimpleEntityskipCRLFskipFullNamethrowFromIOEthrowFromStrEthrowInvalidSpacethrowInvalidSpacethrowLazyErrorthrowNullCharthrowNullParentthrowParseErrorthrowParseErrorthrowUnexpectedCharthrowUnexpectedEOBthrowUnexpectedEOFthrowWfcExceptiontokenTypeDescverifyLimit