APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.util.xml.impl

public abstract Class Parser

extends Object
Class Inheritance
Known Direct Subclasses
jdk.internal.util.xml.impl.ParserSAX
Imports
java.io.IOException, .InputStream, .InputStreamReader, .Reader, .UnsupportedEncodingException, java.util.Arrays, .HashMap, .Locale, .Map, jdk.internal.org.xml.sax.InputSource, .SAXException

XML non-validating parser engine.

Field Summary

Modifier and TypeField and Description
private static final byte[]
asctyp

ASCII character type array.

protected static final int
protected static final int
public static final char
EOS

The end of stream character.

protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
public static final String
protected Pair
private char
protected Attrs
private static final int
protected char[]
protected int
private char[]
private int
private int
private Pair
protected Input
protected Pair
private Map<String, Input>
private char
protected int
protected Input
protected boolean
protected boolean
protected boolean
private String[]
private Pair
private Map<String, Input>
protected int
protected Pair
private String
private Pair
private static final byte[]
nmttyp

NMTOKEN character type array.

private static final char[]
NONS

Default prefixes

protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
private static final char[]
private static final char[]

Constructor Summary

AccessConstructor and Description
protected
Parser()

Constructor.

Method Summary

Modifier and TypeMethod and Description
private void
attr(Pair
An object which reprecents current attribute.
att
)

Parses an attribute.

private String

Returns:

The name of the attribute type.
atype
(Pair
An object which represents current attribute.
att
)

Retrieves attribute type.

private void
bappend(char
The character to append to the buffer.
ch
,
char
The normalization mode.
mode
)

Appends a character to parser's buffer with normalization.

private void
bappend(char
The character to append to the buffer.
ch
)

Appends a character to parser's buffer.

private void
bcopy(int
The character buffer (mChars) start index.
cidx
,
int
The parser buffer (mBuff) start index.
bidx
)

Appends (mChIdx - cidx) characters from character buffer (mChars) to parser's buffer (mBuff).

protected abstract void
bflash()

Reports characters and empties the parser's buffer.

protected abstract void
bflash_ws()

Reports white space characters and empties the parser's buffer.

protected void
bkch()

Puts back the last read character.

private char

Returns:

an id of a keyword or '?'.
bkeyword
()

Recognizes a keyword.

private void
bname(boolean
The true value turns namespace conformance on.
ns
)

Reads a qualified xml name.

private void
bntok()

Reads a nmtoken.

private Reader

Returns:

a reader constructed from the BOM or UTF-8 by default.
bom
(InputStream
A byte stream of the entity.
is
,
char
An encoding hint, character U means UTF-16.
hint
)

Determines the entity encoding.

private void
bqstr(char
'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; '-' - not an attribute value; 'd' - in DTD context.
flag
)

Reads a single or double quoted string into the buffer.

private void
cdat()

Parses a character data.

protected char

Returns:

The type of character.
chtyp
(char
The character to map.
ch
)

Maps a character to its type.

protected void
cleanup()

Cleans up parser internal resources.

private void
comm()

Parses a comment.

protected abstract void
comm(char[]
The comment text starting from first character.
text
,
int
The number of characters in comment.
length
)

Reports a comment.

protected Pair

Returns:

A reference to the next pair in a chain.
del
(Pair
The pair to delete.
pair
)

Deletes an instance of a pair.

protected abstract void
docType(String
The name of the entity.
name
,
String
The public identifier of the entity or null.
pubid
,
String
The system identifier of the entity or null.
sysid
)

Reports document type.

private void
dtd()

Parses the document type declaration.

private void
dtdatt(Pair
An object which represents all defined attributes on an element.
elm
)

Parses an attribute declaration.

private void
dtdattl()

Parses an attribute list declaration.

private void
dtdelm()

Parses an element declaration.

private void
dtdent()

Parses an entity declaration.

private void
dtdnot()

Parses a notation declaration.

private void
dtdsub()

Parses the document type declaration subset.

private void
eappend(char
the next character of an entity name.
ch
)

Recognizes the built-in entities lt, gt, amp, apos, quot.

private Reader

Returns:

a reader constructed from encoding name and input stream.
enc
(String
an encoding name.
name
,
InputStream
the document byte input stream.
is
)

Sets up the document reader.

private void
ensureCapacity(int minCapacity)

private String

Returns:

Name of unresolved entity or null if entity had been resolved successfully.
ent
(char
The 'x' character forces the method to report a skipped entity; 'i' character - indicates non-CDATA normalization.
flag
)

Resolves an entity.

protected String

Returns:

The content of the quoted strign as a string.
eqstr
(char
The '=' character forces the method to accept the '=' character before quoted string and read the following string as not an attribute ('-'), 'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; '-' - not an attribute value; 'd' - in DTD context.
flag
)

Reads an attribute value.

protected Pair

Returns:

A pair with the specified qualified name or null.
find
(Pair
The first element of the chain of pairs.
chain
,
char[]
The qualified name.
qname
)

Finds a pair in the pair chain by a qualified name.

protected char

Returns:

The next character in the document.
getch
()

Retrieves the next character in the document.

protected void
init()

Initializes parser's internals.

private boolean

Returns:

true if a namespace declaration is recognized.
isdecl
(Pair
The attribute qualified name (name.value is a String object which represents the attribute prefix).
name
,
String
The attribute value.
value
)

Recognizes and handles a namespace declaration.

protected String

Returns:

The name has been read.
name
(boolean
The true value turns namespace conformance on.
ns
)

Reads a xml name.

protected abstract void
newPrefix()

Reports new namespace prefix.

protected abstract void
notDecl(String
The notation's name.
name
,
String
The notation's public identifier, or null if none was given.
pubid
,
String
The notation's system identifier, or null if none was given.
sysid
)

Reports notation declaration.

protected Pair

Returns:

An instance of a pair.
pair
(Pair
The reference to a next pair.
next
)

Provedes an instance of a pair.

protected abstract void
panic(String
The problem description message.
msg
)

Notifies the handler about fatal parsing error.

private void
pent(char
The '-' instruct the method to do not set up surrounding spaces [#4.4.8].
flag
)

Resolves a parameter entity.

private void
pi()

Parses a processing instruction.

protected abstract void
pi(String
The processing instruction target name.
target
,
String
The processing instruction body text.
body
)

Reports a processing instruction.

protected void
pop()

Restores previous input on the top of the input stack.

private void
pubsys(Input
The input object.
inp
)

Reads the public or/and system identifiers.

private Pair

Returns:

The public or/and system identifiers pair.
pubsys
(char
The 'N' allows public id be without system id.
flag
)

Reads the public or/and system identifiers.

protected void
push(Input
A new input to set up.
inp
)

Sets up current input on the top of the input stack.

protected char[]

Returns:

The characters of a qualified name.
qname
(boolean
The true value turns namespace conformance on.
ns
)

Reads a qualified xml name.

protected abstract InputSource
resolveEnt(String
The name of the entity.
name
,
String
The public identifier of the entity.
pubid
,
String
The system identifier of the entity.
sysid
)

Returns an InputSource for specified entity or null.

private String

Returns:

The namespace assigned to the prefix.
rslv
(char[] qname)

Resolves a prefix.

protected void
setch(char
The character to set.
ch
)

Sets the current character.

protected void
setinp(InputSource
A new input source to set up.
is
)

Sets up a new input source on the top of the input stack.

protected abstract void
skippedEnt(String
The entity name.
name
)

Reports skipped entity name.

public abstract void
startInternalSub()

Reports the start of DTD internal subset.

protected int

Returns:

Identifier of processed document portion.
step
()

Processes a portion of document.

protected abstract void
unparsedEntDecl(String
The unparsed entity's name.
name
,
String
The entity's public identifier, or null if none was given.
pubid
,
String
The entity's system identifier.
sysid
,
String
The name of the associated notation.
notation
)

Reports unparsed entity name.

private Reader

Returns:

a reader, may be null
utf16
(InputStream
A byte stream of the entity.
is
)

Using a mature technique from Xerces, this method checks further after the bom method above to see if the encoding is UTF-16

protected char

Returns:

The first not white space look ahead character.
wsskip
()

Skips xml white space characters.

private String

Returns:

The xml text declaration encoding or default UTF-8 encoding.
xml
(Reader
is entity reader.
reader
)

Parses the xml text declaration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

asctypback to summary
private static final byte[] asctyp

ASCII character type array. This array maps an ASCII (7 bit) character to the character type.
Possible character type values are:
- ' ' for any kind of white space character;
- 'a' for any lower case alphabetical character value;
- 'A' for any upper case alphabetical character value;
- 'd' for any decimal digit character value;
- 'z' for any character less than ' ' except '\t', '\n', '\r';
An ASCII (7 bit) character which does not fall in any category listed above is mapped to it self.

BUFFSIZE_PARSERback to summary
protected static final int BUFFSIZE_PARSER
BUFFSIZE_READERback to summary
protected static final int BUFFSIZE_READER
EOSback to summary
public static final char EOS

The end of stream character.

EV_CDATback to summary
protected static final int EV_CDAT
EV_COMMback to summary
protected static final int EV_COMM
EV_DTDback to summary
protected static final int EV_DTD
EV_ELMback to summary
protected static final int EV_ELM
EV_ELMEback to summary
protected static final int EV_ELME
EV_ELMSback to summary
protected static final int EV_ELMS
EV_ENTback to summary
protected static final int EV_ENT
EV_NULLback to summary
protected static final int EV_NULL
EV_PIback to summary
protected static final int EV_PI
EV_TEXTback to summary
protected static final int EV_TEXT
EV_WSPCback to summary
protected static final int EV_WSPC
FAULTback to summary
public static final String FAULT
mAttLback to summary
protected Pair mAttL
mAttrIdxback to summary
private char mAttrIdx
mAttrsback to summary
protected Attrs mAttrs
MAX_ARRAY_SIZEback to summary
private static final int MAX_ARRAY_SIZE
mBuffback to summary
protected char[] mBuff
mBuffIdxback to summary
protected int mBuffIdx
mCharsback to summary
private char[] mChars
mChIdxback to summary
private int mChIdx
mChLenback to summary
private int mChLen
mDltdback to summary
private Pair mDltd
mDocback to summary
protected Input mDoc
mElmback to summary
protected Pair mElm
mEntback to summary
private Map<String, Input> mEnt
mEStback to summary
private char mESt
mEvtback to summary
protected int mEvt
mInpback to summary
protected Input mInp
mIsNSAwareback to summary
protected boolean mIsNSAware
mIsSAloneback to summary
protected boolean mIsSAlone
mIsSAloneSetback to summary
protected boolean mIsSAloneSet
mItemsback to summary
private String[] mItems
mNoNSback to summary
private Pair mNoNS
mPEntback to summary
private Map<String, Input> mPEnt
mPhback to summary
protected int mPh
mPrefback to summary
protected Pair mPref
mUnentback to summary
private String mUnent
mXmlback to summary
private Pair mXml
nmttypback to summary
private static final byte[] nmttyp

NMTOKEN character type array. This array maps an ASCII (7 bit) character to the character type.
Possible character type values are:
- 0 for underscore ('_') or any lower and upper case alphabetical character value;
- 1 for colon (':') character;
- 2 for dash ('-') and dot ('.') or any decimal digit character value;
- 3 for any kind of white space character
An ASCII (7 bit) character which does not fall in any category listed above is mapped to 0xff.

NONSback to summary
private static final char[] NONS

Default prefixes

PH_AFTER_DOCback to summary
protected static final int PH_AFTER_DOC
PH_BEFORE_DOCback to summary
protected static final int PH_BEFORE_DOC
PH_DOC_STARTback to summary
protected static final int PH_DOC_START
PH_DOCELMback to summary
protected static final int PH_DOCELM
PH_DOCELM_MISCback to summary
protected static final int PH_DOCELM_MISC
PH_DTDback to summary
protected static final int PH_DTD
PH_DTD_MISCback to summary
protected static final int PH_DTD_MISC
PH_MISC_DTDback to summary
protected static final int PH_MISC_DTD
XMLback to summary
private static final char[] XML
XMLNSback to summary
private static final char[] XMLNS

Constructor Detail

Parserback to summary
protected Parser()

Constructor.

Annotations
@SuppressWarnings:this-escape

Method Detail

attrback to summary
private void attr(Pair att) throws Exception

Parses an attribute. This recursive method is responsible for prefix addition ( mPref) on the way down. The element's start tag end triggers the return process. The method then on it's way back resolves prefixes and accumulates attributes.

att.num carries attribute flags where: 0x1 - attribute is declared in DTD (attribute declaration had been read); 0x2 - attribute's default value is used.

Parameters
att:Pair

An object which reprecents current attribute.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
atypeback to summary
private String atype(Pair att) throws Exception

Retrieves attribute type. This method sets the type of normalization in the attribute id field and returns the name of attribute type.

Parameters
att:Pair

An object which represents current attribute.

Returns:String

The name of the attribute type.

Exceptions
Exception:
is parser specific exception form panic method.
bappendback to summary
private void bappend(char ch, char mode) throws Exception

Appends a character to parser's buffer with normalization.

Parameters
ch:char

The character to append to the buffer.

mode:char

The normalization mode.

bappendback to summary
private void bappend(char ch) throws Exception

Appends a character to parser's buffer.

Parameters
ch:char

The character to append to the buffer.

bcopyback to summary
private void bcopy(int cidx, int bidx) throws Exception

Appends (mChIdx - cidx) characters from character buffer (mChars) to parser's buffer (mBuff).

Parameters
cidx:int

The character buffer (mChars) start index.

bidx:int

The parser buffer (mBuff) start index.

bflashback to summary
protected abstract void bflash() throws Exception

Reports characters and empties the parser's buffer. This method is called only if parser is going to return control to the main loop. This means that this method may use parser buffer to report white space without copying characters to temporary buffer.

bflash_wsback to summary
protected abstract void bflash_ws() throws Exception

Reports white space characters and empties the parser's buffer. This method is called only if parser is going to return control to the main loop. This means that this method may use parser buffer to report white space without copying characters to temporary buffer.

bkchback to summary
protected void bkch() throws Exception

Puts back the last read character. This method MUST NOT be called more then once after each call of getch method.

bkeywordback to summary
private char bkeyword() throws Exception

Recognizes a keyword. This is low level routine which recognizes one of keywords in the buffer. Keyword Id ID - i IDREF - r IDREFS - R ENTITY - n ENTITIES - N NMTOKEN - t NMTOKENS - T ELEMENT - e ATTLIST - a NOTATION - o CDATA - c REQUIRED - Q IMPLIED - I FIXED - F

Returns:char

an id of a keyword or '?'.

Exceptions
Exception:
is parser specific exception form panic method.
bnameback to summary
private void bname(boolean ns) throws Exception

Reads a qualified xml name. This is low level routine which leaves a qName in the buffer. The characters of a qualified name is an array of characters. The first (chars[0]) character is the index of the colon character which separates the prefix from the local name. If the index is zero, the name does not contain separator or the parser works in the namespace unaware mode. The length of qualified name is the length of the array minus one.

Parameters
ns:boolean

The true value turns namespace conformance on.

Exceptions
Exception:
is parser specific exception form panic method.
bntokback to summary
private void bntok() throws Exception

Reads a nmtoken. This is low level routine which leaves a nmtoken in the buffer.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
bomback to summary
private Reader bom(InputStream is, char hint) throws Exception

Determines the entity encoding. This method gets encoding from Byte Order Mask [#4.3.3] if any. Note, the first byte returned by the entity's byte stream has to be the first byte in the entity. Also, there is no support for UCS-4.

Parameters
is:InputStream

A byte stream of the entity.

hint:char

An encoding hint, character U means UTF-16.

Returns:Reader

a reader constructed from the BOM or UTF-8 by default.

Exceptions
Exception:
is parser specific exception form panic method.
bqstrback to summary
private void bqstr(char flag) throws Exception

Reads a single or double quoted string into the buffer. This method resolves entities inside a string unless the parser parses DTD.

Parameters
flag:char

'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; '-' - not an attribute value; 'd' - in DTD context.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
cdatback to summary
private void cdat() throws Exception

Parses a character data. The '<!' part is read in dispatcher so the method starts with first '[' after '<!'.

Exceptions
Exception:
is parser specific exception form panic method.
chtypback to summary
protected char chtyp(char ch)

Maps a character to its type. Possible character type values are:

  • ' ' - for any kind of whitespace character;
  • 'a' - for any lower case alphabetical character value;
  • 'A' - for any upper case alphabetical character value;
  • 'd' - for any decimal digit character value;
  • 'z' - for any character less than ' ' except '\t', '\n', '\r';
  • 'X' - for any not ASCII character;
  • 'Z' - for EOS character.
An ASCII (7 bit) character which does not fall in any category listed above is mapped to itself.
Parameters
ch:char

The character to map.

Returns:char

The type of character.

cleanupback to summary
protected void cleanup()

Cleans up parser internal resources.

commback to summary
private void comm() throws Exception

Parses a comment. The '<!' part is read in dispatcher so the method starts with first '-' after '<!'.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
commback to summary
protected abstract void comm(char[] text, int length)

Reports a comment.

Parameters
text:char[]

The comment text starting from first character.

length:int

The number of characters in comment.

delback to summary
protected Pair del(Pair pair)

Deletes an instance of a pair.

Parameters
pair:Pair

The pair to delete.

Returns:Pair

A reference to the next pair in a chain.

docTypeback to summary
protected abstract void docType(String name, String pubid, String sysid) throws SAXException

Reports document type.

Parameters
name:String

The name of the entity.

pubid:String

The public identifier of the entity or null.

sysid:String

The system identifier of the entity or null.

dtdback to summary
private void dtd() throws Exception

Parses the document type declaration.

Exceptions
Exception:
is parser specific exception form panic method.
dtdattback to summary
private void dtdatt(Pair elm) throws Exception

Parses an attribute declaration. The attribute uses the following fields of Pair object: chars - characters of qualified name id - the type identifier of the attribute list - a pair which holds the default value (chars field)

Parameters
elm:Pair

An object which represents all defined attributes on an element.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
dtdattlback to summary
private void dtdattl() throws Exception

Parses an attribute list declaration. This method parses the declaration up to the closing angle bracket.

Exceptions
Exception:
is parser specific exception form panic method.
dtdelmback to summary
private void dtdelm() throws Exception

Parses an element declaration. This method parses the declaration up to the closing angle bracket.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
dtdentback to summary
private void dtdent() throws Exception

Parses an entity declaration. This method fills the general ( mEnt) and parameter ( mPEnt) entity look up table.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
dtdnotback to summary
private void dtdnot() throws Exception

Parses a notation declaration. This method parses the declaration up to the closing angle bracket.

Exceptions
Exception:
is parser specific exception form panic method.
dtdsubback to summary
private void dtdsub() throws Exception

Parses the document type declaration subset.

Exceptions
Exception:
is parser specific exception form panic method.
eappendback to summary
private void eappend(char ch)

Recognizes the built-in entities lt, gt, amp, apos, quot. The initial state is 0x100. Any state belowe 0x100 is a built-in entity replacement character.

Parameters
ch:char

the next character of an entity name.

Annotations
@SuppressWarnings:fallthrough
encback to summary
private Reader enc(String name, InputStream is) throws UnsupportedEncodingException

Sets up the document reader.

Parameters
name:String

an encoding name.

is:InputStream

the document byte input stream.

Returns:Reader

a reader constructed from encoding name and input stream.

ensureCapacityback to summary
private void ensureCapacity(int minCapacity) throws Exception
entback to summary
private String ent(char flag) throws Exception

Resolves an entity. This method resolves built-in and character entity references. It is also reports external entities to the application.

Parameters
flag:char

The 'x' character forces the method to report a skipped entity; 'i' character - indicates non-CDATA normalization.

Returns:String

Name of unresolved entity or null if entity had been resolved successfully.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
eqstrback to summary
protected String eqstr(char flag) throws Exception

Reads an attribute value. The grammar this method can read is:

eqstr := S "=" qstr
qstr  := S ("'" string "'") | ('"' string '"')
This method resolves entities inside a string unless the parser parses DTD.
Parameters
flag:char

The '=' character forces the method to accept the '=' character before quoted string and read the following string as not an attribute ('-'), 'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; '-' - not an attribute value; 'd' - in DTD context.

Returns:String

The content of the quoted strign as a string.

Exceptions
Exception:
is parser specific exception form panic method.
findback to summary
protected Pair find(Pair chain, char[] qname)

Finds a pair in the pair chain by a qualified name.

Parameters
chain:Pair

The first element of the chain of pairs.

qname:char[]

The qualified name.

Returns:Pair

A pair with the specified qualified name or null.

getchback to summary
protected char getch() throws IOException

Retrieves the next character in the document.

Returns:char

The next character in the document.

initback to summary
protected void init()

Initializes parser's internals. Note, current input has to be set before this method is called.

isdeclback to summary
private boolean isdecl(Pair name, String value)

Recognizes and handles a namespace declaration. This method identifies a type of namespace declaration if any and puts new mapping on top of prefix stack.

Parameters
name:Pair

The attribute qualified name (name.value is a String object which represents the attribute prefix).

value:String

The attribute value.

Returns:boolean

true if a namespace declaration is recognized.

nameback to summary
protected String name(boolean ns) throws Exception

Reads a xml name. The xml name must conform "Namespaces in XML" specification. Therefore the ':' character is not allowed in the name. This method should be used for PI and entity names which may not have a namespace according to the specification mentioned above.

Parameters
ns:boolean

The true value turns namespace conformance on.

Returns:String

The name has been read.

Exceptions
Exception:
When incorrect character appear in the name.
newPrefixback to summary
protected abstract void newPrefix() throws Exception

Reports new namespace prefix. The Namespace prefix ( mPref.name) being declared and the Namespace URI ( mPref.value) the prefix is mapped to. An empty string is used for the default element namespace, which has no prefix.

notDeclback to summary
protected abstract void notDecl(String name, String pubid, String sysid) throws Exception

Reports notation declaration.

Parameters
name:String

The notation's name.

pubid:String

The notation's public identifier, or null if none was given.

sysid:String

The notation's system identifier, or null if none was given.

pairback to summary
protected Pair pair(Pair next)

Provedes an instance of a pair.

Parameters
next:Pair

The reference to a next pair.

Returns:Pair

An instance of a pair.

panicback to summary
protected abstract void panic(String msg) throws Exception

Notifies the handler about fatal parsing error.

Parameters
msg:String

The problem description message.

pentback to summary
private void pent(char flag) throws Exception

Resolves a parameter entity. This method resolves a parameter entity references. It is also reports external entities to the application.

Parameters
flag:char

The '-' instruct the method to do not set up surrounding spaces [#4.4.8].

Exceptions
Exception:
is parser specific exception form panic method.
piback to summary
private void pi() throws Exception

Parses a processing instruction. The '<?' is read in dispatcher so the method starts with first character of PI target name after '<?'.

Exceptions
Exception:
is parser specific exception form panic method.
piback to summary
protected abstract void pi(String target, String body) throws Exception

Reports a processing instruction.

Parameters
target:String

The processing instruction target name.

body:String

The processing instruction body text.

popback to summary
protected void pop()

Restores previous input on the top of the input stack.

pubsysback to summary
private void pubsys(Input inp) throws Exception

Reads the public or/and system identifiers.

Parameters
inp:Input

The input object.

Exceptions
Exception:
is parser specific exception form panic method.
pubsysback to summary
private Pair pubsys(char flag) throws Exception

Reads the public or/and system identifiers.

Parameters
flag:char

The 'N' allows public id be without system id.

Returns:Pair

The public or/and system identifiers pair.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
pushback to summary
protected void push(Input inp)

Sets up current input on the top of the input stack.

Parameters
inp:Input

A new input to set up.

qnameback to summary
protected char[] qname(boolean ns) throws Exception

Reads a qualified xml name. The characters of a qualified name is an array of characters. The first (chars[0]) character is the index of the colon character which separates the prefix from the local name. If the index is zero, the name does not contain separator or the parser works in the namespace unaware mode. The length of qualified name is the length of the array minus one.

Parameters
ns:boolean

The true value turns namespace conformance on.

Returns:char[]

The characters of a qualified name.

Exceptions
Exception:
When incorrect character appear in the name.
resolveEntback to summary
protected abstract InputSource resolveEnt(String name, String pubid, String sysid) throws Exception

Returns an InputSource for specified entity or null.

Parameters
name:String

The name of the entity.

pubid:String

The public identifier of the entity.

sysid:String

The system identifier of the entity.

rslvback to summary
private String rslv(char[] qname) throws Exception

Resolves a prefix.

Returns:String

The namespace assigned to the prefix.

Exceptions
Exception:
When mapping for specified prefix is not found.
setchback to summary
protected void setch(char ch)

Sets the current character.

Parameters
ch:char

The character to set.

setinpback to summary
protected void setinp(InputSource is) throws Exception

Sets up a new input source on the top of the input stack. Note, the first byte returned by the entity's byte stream has to be the first byte in the entity. However, the parser does not expect the byte order mask in both cases when encoding is provided by the input source.

Parameters
is:InputSource

A new input source to set up.

Exceptions
Exception:
is parser specific exception form panic method.
IOException:
If any IO errors occur.
skippedEntback to summary
protected abstract void skippedEnt(String name) throws Exception

Reports skipped entity name.

Parameters
name:String

The entity name.

startInternalSubback to summary
public abstract void startInternalSub() throws SAXException

Reports the start of DTD internal subset.

Exceptions
SAXException:
if the receiver throws SAXException
stepback to summary
protected int step() throws Exception

Processes a portion of document. This method returns one of EV_* constants as an identifier of the portion of document have been read.

Returns:int

Identifier of processed document portion.

Annotations
@SuppressWarnings:fallthrough
Exceptions
Exception:
is parser specific exception form panic method.
unparsedEntDeclback to summary
protected abstract void unparsedEntDecl(String name, String pubid, String sysid, String notation) throws Exception

Reports unparsed entity name.

Parameters
name:String

The unparsed entity's name.

pubid:String

The entity's public identifier, or null if none was given.

sysid:String

The entity's system identifier.

notation:String

The name of the associated notation.

utf16back to summary
private Reader utf16(InputStream is) throws Exception

Using a mature technique from Xerces, this method checks further after the bom method above to see if the encoding is UTF-16

Parameters
is:InputStream

A byte stream of the entity.

Returns:Reader

a reader, may be null

Exceptions
Exception:
is parser specific exception form panic method.
wsskipback to summary
protected char wsskip() throws IOException

Skips xml white space characters. This method skips white space characters (' ', '\t', '\n', '\r') and looks ahead not white space character.

Returns:char

The first not white space look ahead character.

xmlback to summary
private String xml(Reader reader) throws Exception

Parses the xml text declaration. This method gets encoding from the xml text declaration [#4.3.1] if any. The method assumes the buffer (mChars) is big enough to accommodate whole xml text declaration.

Parameters
reader:Reader

is entity reader.

Returns:String

The xml text declaration encoding or default UTF-8 encoding.

Exceptions
Exception:
is parser specific exception form panic method.