Package com.fasterxml.aalto.in
Class InputBootstrapper
java.lang.Object
com.fasterxml.aalto.in.InputBootstrapper
- All Implemented Interfaces:
XmlConsts
- Direct Known Subclasses:
ByteSourceBootstrapper,CharSourceBootstrapper
Abstract base class that defines shared functionality between different
bootstrappers (byte stream, char Readers, block input)
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ReaderConfigprotected intCurrent number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.protected intCurrent row location of current point in input buffer, using zero-based counting.protected intCurrent index of the first character of the current row in input buffer.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String(package private) intXML declaration from the input (1.0, 1.1 or 'unknown')(package private) StringValue of encoding pseudo-attribute from xml declaration, if one was found; null otherwise.(package private) final char[]Need a short buffer to read in values of pseudo-attributes (version, encoding, standalone).(package private) StringFields inherited from interface com.fasterxml.aalto.util.XmlConsts
CHAR_CR, CHAR_LF, CHAR_NULL, CHAR_SPACE, MAX_UNICODE_CHAR, STAX_DEFAULT_OUTPUT_ENCODING, STAX_DEFAULT_OUTPUT_VERSION, XML_DECL_KW_ENCODING, XML_DECL_KW_STANDALONE, XML_DECL_KW_VERSION, XML_SA_NO, XML_SA_YES, XML_V_10, XML_V_10_STR, XML_V_11, XML_V_11_STR, XML_V_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract XmlScannerMain bootstrapping method, which will try to open the underlying input source, check its encoding, read xml declaration if there is one, and finally create a scanner for actual parsing.protected abstract intcheckKeyword(String exp) protected abstract Locationprotected abstract intgetNext()protected abstract intgetNextAfterWs(boolean reqWs) private final intgetWsOrChar(int ok) Method that should get next character, which has to be either specified character (usually end marker), OR, any character as long as there' at least one space character before it.private final intprotected abstract voidpushback()protected abstract intreadQuotedValue(char[] kw, int quoteChar) protected voidMethod that will parse xml declaration, which at this point is known to exist.private final Stringprivate final Stringprivate final intprotected voidprotected voidprotected final voidreportPseudoAttrProblem(String attrName, String got, String expVal1, String expVal2) protected voidreportUnexpectedChar(int i, String msg) protected voidreportXmlProblem(String msg)
-
Field Details
-
ERR_XMLDECL_KW_VERSION
- See Also:
-
ERR_XMLDECL_KW_ENCODING
- See Also:
-
ERR_XMLDECL_KW_STANDALONE
- See Also:
-
ERR_XMLDECL_END_MARKER
- See Also:
-
ERR_XMLDECL_EXP_SPACE
- See Also:
-
ERR_XMLDECL_EXP_EQ
- See Also:
-
ERR_XMLDECL_EXP_ATTRVAL
- See Also:
-
_inputProcessed
protected int _inputProcessedCurrent number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.Note: includes possible BOMs, if those were part of the input.
-
_inputRow
protected int _inputRowCurrent row location of current point in input buffer, using zero-based counting. -
_inputRowStart
protected int _inputRowStartCurrent index of the first character of the current row in input buffer. Needed to calculate column position, if necessary; benefit of not having column itself is that this only has to be updated once per line. -
_config
-
mDeclaredXmlVersion
int mDeclaredXmlVersionXML declaration from the input (1.0, 1.1 or 'unknown') -
mFoundEncoding
String mFoundEncodingValue of encoding pseudo-attribute from xml declaration, if one was found; null otherwise. -
mStandalone
String mStandalone -
mKeyword
final char[] mKeywordNeed a short buffer to read in values of pseudo-attributes (version, encoding, standalone). Don't really need tons of space; just enough for the longest anticipated encoding id... and maybe few chars just in case (for additional white space that we ignore)
-
-
Constructor Details
-
InputBootstrapper
-
-
Method Details
-
bootstrap
Main bootstrapping method, which will try to open the underlying input source, check its encoding, read xml declaration if there is one, and finally create a scanner for actual parsing.- Throws:
XMLStreamException
-
readXmlDeclaration
Method that will parse xml declaration, which at this point is known to exist.- Throws:
IOExceptionXMLStreamException
-
readXmlVersion
- Returns:
- Xml version declaration read
- Throws:
IOExceptionXMLStreamException
-
readXmlEncoding
- Throws:
IOExceptionXMLStreamException
-
readXmlStandalone
- Throws:
IOExceptionXMLStreamException
-
handleEq
- Throws:
IOExceptionXMLStreamException
-
getWsOrChar
Method that should get next character, which has to be either specified character (usually end marker), OR, any character as long as there' at least one space character before it.- Throws:
IOExceptionXMLStreamException
-
pushback
protected abstract void pushback() -
getNext
- Throws:
IOExceptionXMLStreamException
-
getNextAfterWs
- Throws:
IOExceptionXMLStreamException
-
checkKeyword
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOExceptionXMLStreamException
-
readQuotedValue
protected abstract int readQuotedValue(char[] kw, int quoteChar) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
getLocation
-
reportXmlProblem
- Throws:
XMLStreamException
-
reportNull
- Throws:
XMLStreamException
-
reportEof
- Throws:
XMLStreamException
-
reportUnexpectedChar
- Throws:
XMLStreamException
-
reportPseudoAttrProblem
protected final void reportPseudoAttrProblem(String attrName, String got, String expVal1, String expVal2) throws XMLStreamException - Throws:
XMLStreamException
-