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 ReaderConfig
protected int
Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.protected int
Current row location of current point in input buffer, using zero-based counting.protected int
Current index of the first character of the current row in input buffer.static final String
static final String
static final String
static final String
static final String
static final String
static final String
(package private) int
XML declaration from the input (1.0, 1.1 or 'unknown')(package private) String
Value 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) String
Fields 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 XmlScanner
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.protected abstract int
checkKeyword
(String exp) protected abstract Location
protected abstract int
getNext()
protected abstract int
getNextAfterWs
(boolean reqWs) private final int
getWsOrChar
(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 int
protected abstract void
pushback()
protected abstract int
readQuotedValue
(char[] kw, int quoteChar) protected void
Method that will parse xml declaration, which at this point is known to exist.private final String
private final String
private final int
protected void
protected void
protected final void
reportPseudoAttrProblem
(String attrName, String got, String expVal1, String expVal2) protected void
reportUnexpectedChar
(int i, String msg) protected void
reportXmlProblem
(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:
IOException
XMLStreamException
-
readXmlVersion
- Returns:
- Xml version declaration read
- Throws:
IOException
XMLStreamException
-
readXmlEncoding
- Throws:
IOException
XMLStreamException
-
readXmlStandalone
- Throws:
IOException
XMLStreamException
-
handleEq
- Throws:
IOException
XMLStreamException
-
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:
IOException
XMLStreamException
-
pushback
protected abstract void pushback() -
getNext
- Throws:
IOException
XMLStreamException
-
getNextAfterWs
- Throws:
IOException
XMLStreamException
-
checkKeyword
- Returns:
- First character that does not match expected, if any; CHAR_NULL if match succeeded
- Throws:
IOException
XMLStreamException
-
readQuotedValue
protected abstract int readQuotedValue(char[] kw, int quoteChar) throws IOException, XMLStreamException - Throws:
IOException
XMLStreamException
-
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
-