public class XMLEntityScanner extends Object implements XMLLocator
| Modifier and Type | Field and Description |
|---|---|
protected static String |
ALLOW_JAVA_ENCODINGS
Feature identifier: allow Java encodings.
|
protected static String |
ERROR_REPORTER
Property identifier: error reporter.
|
protected boolean |
fAllowJavaEncodings
Allow Java encoding names.
|
protected int |
fBufferSize |
protected Entity.ScannedEntity |
fCurrentEntity |
protected XMLEntityManager |
fEntityManager |
protected XMLErrorReporter |
fErrorReporter |
protected PropertyManager |
fPropertyManager |
protected SymbolTable |
fSymbolTable |
protected static String |
SYMBOL_TABLE
Property identifier: symbol table.
|
| Constructor and Description |
|---|
XMLEntityScanner()
Default constructor.
|
XMLEntityScanner(PropertyManager propertyManager,
XMLEntityManager entityManager)
private constructor, this class can only be instantiated within this class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
arrangeCapacity(int length) |
boolean |
arrangeCapacity(int length,
boolean changeEntity) |
protected Reader |
createReader(InputStream inputStream,
String encoding,
Boolean isBigEndian)
Creates a reader capable of reading the given input stream in
the specified encoding.
|
String |
getBaseSystemId()
Returns the base system identifier of the currently scanned
entity, or null if none is available.
|
int |
getChar(int relative) |
int |
getCharacterOffset()
Returns the character offset, or
-1 if no character offset is available. |
int |
getColumnNumber()
Returns the column number, or
-1 if no column number is available. |
Entity.ScannedEntity |
getCurrentEntity() |
String |
getEncoding()
Returns the encoding of the current entity.
|
protected Object[] |
getEncodingName(byte[] b4,
int count)
Returns the IANA encoding name that is auto-detected from
the bytes specified, with the endian-ness of that encoding where appropriate.
|
String |
getExpandedSystemId()
Returns the expanded system identifier.
|
int |
getLineNumber()
Returns the line number, or
-1 if no line number is available. |
String |
getLiteralSystemId()
Returns the literal system identifier.
|
String |
getPublicId()
Returns the public identifier.
|
String |
getVersion() |
String |
getXMLVersion()
Returns the XML version of the current entity.
|
boolean |
isExternal()
Returns true if the current entity being scanned is external.
|
boolean |
isSpace(char ch) |
int |
peekChar()
Returns the next character on the input.
|
void |
registerListener(XMLBufferListener listener)
Registers the listener object and provides callback.
|
void |
reset(PropertyManager propertyManager)
Resets the components.
|
void |
reset(SymbolTable symbolTable,
XMLEntityManager entityManager,
XMLErrorReporter reporter) |
void |
reset(XMLComponentManager componentManager)
Resets the component.
|
int |
scanChar()
Returns the next character on the input.
|
int |
scanContent(XMLString content)
CHANGED:
Scans a range of parsed character data, This function appends the character data to
the supplied buffer.
|
boolean |
scanData(String delimiter,
XMLStringBuffer buffer)
Scans a range of character data up to the specified delimiter,
setting the fields of the XMLString structure, appropriately.
|
int |
scanLiteral(int quote,
XMLString content)
Scans a range of attribute value data, setting the fields of the
XMLString structure, appropriately.
|
String |
scanName()
Returns a string matching the Name production appearing immediately
on the input as a symbol, or null if no Name string is present.
|
String |
scanNmtoken()
Returns a string matching the NMTOKEN production appearing immediately
on the input as a symbol, or null if NMTOKEN Name string is present.
|
boolean |
scanQName(QName qname)
Scans a qualified name from the input, setting the fields of the
QName structure appropriately.
|
void |
setBaseSystemId(String systemId) |
void |
setBufferSize(int size) |
void |
setColumnNumber(int col) |
void |
setCurrentEntity(Entity.ScannedEntity scannedEntity)
set the instance of current scanned entity.
|
void |
setEncoding(String encoding)
Sets the encoding of the scanner.
|
void |
setExpandedSystemId(String systemId) |
void |
setLineNumber(int line) |
void |
setLiteralSystemId(String systemId) |
void |
setPublicId(String publicId) |
void |
setVersion(String version)
the version of the current entity being scanned
|
void |
setXMLVersion(String xmlVersion)
Sets the XML version.
|
boolean |
skipChar(int c)
Skips a character appearing immediately on the input.
|
boolean |
skipDeclSpaces()
Skips space characters appearing immediately on the input that would
match non-terminal S (0x09, 0x0A, 0x0D, 0x20) before end of line
normalization is performed.
|
boolean |
skipSpaces()
Skips space characters appearing immediately on the input.
|
boolean |
skipString(char[] s) |
boolean |
skipString(String s)
Skips the specified string appearing immediately on the input.
|
protected Entity.ScannedEntity fCurrentEntity
protected int fBufferSize
protected XMLEntityManager fEntityManager
protected SymbolTable fSymbolTable
protected XMLErrorReporter fErrorReporter
protected boolean fAllowJavaEncodings
protected static final String SYMBOL_TABLE
protected static final String ERROR_REPORTER
protected static final String ALLOW_JAVA_ENCODINGS
protected PropertyManager fPropertyManager
public XMLEntityScanner()
public XMLEntityScanner(PropertyManager propertyManager, XMLEntityManager entityManager)
getEntityScanner(),
getEntityScanner(ScannedEntity)public final void setBufferSize(int size)
public void reset(PropertyManager propertyManager)
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException
componentManager - The component manager.SAXException - Thrown by component on initialization error.
For example, if a feature or property is
required for the operation of the component, the
component manager may throw a
SAXNotRecognizedException or a
SAXNotSupportedException.XMLConfigurationExceptionpublic final void reset(SymbolTable symbolTable, XMLEntityManager entityManager, XMLErrorReporter reporter)
public final String getXMLVersion()
getXMLVersion in interface XMLLocatorpublic final void setXMLVersion(String xmlVersion)
xmlVersion - the XML version of the current entitypublic final void setCurrentEntity(Entity.ScannedEntity scannedEntity)
ScannedEntity - public Entity.ScannedEntity getCurrentEntity()
public final String getBaseSystemId()
getBaseSystemId in interface XMLLocatorpublic void setBaseSystemId(String systemId)
public final int getLineNumber()
XMLLocator-1 if no line number is available.getLineNumber in interface XMLLocatorpublic void setLineNumber(int line)
jdk7u.jaxp.org.apache.xerces.external.xni.XMLLocator#setLineNumber(int)public final int getColumnNumber()
XMLLocator-1 if no column number is available.getColumnNumber in interface XMLLocatorpublic void setColumnNumber(int col)
jdk7u.jaxp.org.apache.xerces.external.xni.XMLLocator#setColumnNumber(int)public final int getCharacterOffset()
XMLLocator-1 if no character offset is available.getCharacterOffset in interface XMLLocatorpublic final String getExpandedSystemId()
getExpandedSystemId in interface XMLLocatorpublic void setExpandedSystemId(String systemId)
public final String getLiteralSystemId()
getLiteralSystemId in interface XMLLocatorpublic void setLiteralSystemId(String systemId)
public final String getPublicId()
getPublicId in interface XMLLocatorpublic void setPublicId(String publicId)
public void setVersion(String version)
public String getVersion()
public final String getEncoding()
getEncoding in interface XMLLocatorpublic final void setEncoding(String encoding) throws IOException
Note: The underlying character reader on the current entity will be changed to accomodate the new encoding. However, the new encoding is ignored if the current reader was not constructed from an input stream (e.g. an external entity that is resolved directly to the appropriate java.io.Reader object).
encoding - The IANA encoding name of the new encoding.IOException - Thrown if the new encoding is not supported.EncodingMappublic final boolean isExternal()
public int getChar(int relative)
throws IOException
IOExceptionpublic int peekChar()
throws IOException
Note: The character is not consumed.
IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public int scanChar()
throws IOException
Note: The character is consumed.
IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public String scanNmtoken() throws IOException
Note: The NMTOKEN characters are consumed.
Note: The string returned must be a symbol. The SymbolTable can be used for this purpose.
IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.SymbolTable,
XMLChar.isName(int)public String scanName() throws IOException
Note: The Name characters are consumed.
Note: The string returned must be a symbol. The SymbolTable can be used for this purpose.
IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.SymbolTable,
XMLChar.isName(int),
XMLChar.isNameStart(int)public boolean scanQName(QName qname) throws IOException
Note: The qualified name characters are consumed.
Note: The strings used to set the values of the QName structure must be symbols. The SymbolTable can be used for this purpose.
qname - The qualified name structure to fill.IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.SymbolTable,
XMLChar.isName(int),
XMLChar.isNameStart(int)public int scanContent(XMLString content) throws IOException
Note: The characters are consumed.
Note: This method does not guarantee to return the longest run of parsed character data. This method may return before markup due to reaching the end of the input buffer or any other reason.
content - The content structure to fill.IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public int scanLiteral(int quote,
XMLString content)
throws IOException
Note: The characters are consumed.
Note: This method does not guarantee to return the longest run of attribute value data. This method may return before the quote character due to reaching the end of the input buffer or any other reason.
Note: The fields contained in the XMLString structure are not guaranteed to remain valid upon subsequent calls to the entity scanner. Therefore, the caller is responsible for immediately using the returned character data or making a copy of the character data.
quote - The quote character that signifies the end of the
attribute value data.content - The content structure to fill.IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public boolean scanData(String delimiter, XMLStringBuffer buffer) throws IOException
Note: The characters are consumed.
Note: This assumes that the length of the delimiter and that the delimiter contains at least one character.
Note: This method does not guarantee to return the longest run of character data. This method may return before the delimiter due to reaching the end of the input buffer or any other reason.
delimiter - The string that signifies the end of the character
data to be scanned.buffer - The XMLStringBuffer to fill.IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public boolean skipChar(int c)
throws IOException
Note: The character is consumed only if it matches the specified character.
c - The character to skip.IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public boolean isSpace(char ch)
public boolean skipSpaces()
throws IOException
Note: The characters are consumed only if they are space characters.
IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.XMLChar.isSpace(int)public boolean arrangeCapacity(int length)
throws IOException
legnth - This function checks that following number of characters are available.
to the underlying buffer.IOExceptionpublic boolean arrangeCapacity(int length,
boolean changeEntity)
throws IOException
legnth - This function checks that following number of characters are available.
to the underlying buffer.if - the underlying function should change the entityIOExceptionpublic boolean skipString(String s) throws IOException
Note: The characters are consumed only if all the characters are skipped.
s - The string to skip.IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.public boolean skipString(char[] s)
throws IOException
IOExceptionprotected Reader createReader(InputStream inputStream, String encoding, Boolean isBigEndian) throws IOException
inputStream - The input stream.encoding - The encoding name that the input stream is
encoded using. If the user has specified that
Java encoding names are allowed, then the
encoding name may be a Java encoding name;
otherwise, it is an ianaEncoding name.isBigEndian - For encodings (like uCS-4), whose names cannot
specify a byte order, this tells whether the order is bigEndian. null menas
unknown or not relevant.IOExceptionprotected Object[] getEncodingName(byte[] b4, int count)
b4 - The first four bytes of the input.count - The number of bytes actually read.public void registerListener(XMLBufferListener listener)
listener - listener to which call back should be provided when scanner buffer
is being changed.public final boolean skipDeclSpaces()
throws IOException
Note: The characters are consumed only if they would match non-terminal S before end of line normalization is performed.
IOException - Thrown if i/o error occurs.EOFException - Thrown on end of file.XMLChar.isSpace(int)Copyright © 2018–2021 mhoffrogge. All rights reserved.