Class InputEntity
For internal entities, the character arrays are referenced here, and read from as needed (they're read-only). External entities have mutable buffers, that are read into as needed.
Note: This maps CRLF (and CR) to LF without regard for whether it's in an external (parsed) entity or not. The XML 1.0 spec is inconsistent in explaining EOL handling; this is the sensible way.
- Version:
- 1.4 00/08/05
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate char[]
private static final int
private DTDEventListener
private int
private InputSource
private boolean
private boolean
private int
private Locale
private boolean
private String
private static final char[]
private InputEntity
private Reader
private StringBuffer
private boolean
private int
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
checkRecursion
(InputEntity stack) private boolean
checkSurrogatePair
(int offset) void
close()
private void
private void
fillbuf()
char
getc()
gets the next Java character -- might be part of an XML text character represented by a surrogate pair, or be the end of the entity.int
returns -1; maintaining column numbers hurts performanceReturns the name of the encoding in use, else null; the name returned is in as standard a form as we can get.static InputEntity
int
Returns the current line number in this input sourcegetName()
char
returns the next name char, or NUL ...Returns the public ID of this input source, if knownReturns the system ID of this input source, if knownprivate InputEntity
boolean
ignorableWhitespace
(DTDEventListener handler) whitespace in markup (flagged to app, discardable)void
init
(char[] b, String name, InputEntity stack, boolean isPE) void
init
(InputSource in, String name, InputEntity stack, boolean isPE) boolean
boolean
isEOF()
returns true iff there's no more data to consume ...boolean
boolean
boolean
optional grammatical whitespace (discarded)boolean
parsedContent
(DTDEventListener docHandler) normal content; whitespace in markup may be handled specially if the parser uses the content model.boolean
returns false iff 'next' string isn't as provided, else skips that text and returns true.boolean
peekc
(char c) lookahead one characterpop()
void
void
ungetc()
two character pushback is guaranteedboolean
unparsedContent
(DTDEventListener docHandler, boolean ignorableWhitespace, String whitespaceInvalidMessage) CDATA -- character data, terminated by"]]>"
and optionally including unescaped markup delimiters (ampersand and left angle bracket).
-
Field Details
-
start
private int start -
finish
private int finish -
buf
private char[] buf -
lineNumber
private int lineNumber -
returnedFirstHalf
private boolean returnedFirstHalf -
maybeInCRLF
private boolean maybeInCRLF -
name
-
next
-
input
-
reader
-
isClosed
private boolean isClosed -
errHandler
-
locale
-
rememberedText
-
startRemember
private int startRemember -
isPE
private boolean isPE -
BUFSIZ
private static final int BUFSIZ- See Also:
-
newline
private static final char[] newline
-
-
Constructor Details
-
InputEntity
private InputEntity()
-
-
Method Details
-
getInputEntity
-
isInternal
public boolean isInternal() -
isDocument
public boolean isDocument() -
isParameterEntity
public boolean isParameterEntity() -
getName
-
init
public void init(InputSource in, String name, InputEntity stack, boolean isPE) throws IOException, SAXException - Throws:
IOException
SAXException
-
init
- Throws:
SAXException
-
checkRecursion
- Throws:
SAXException
-
pop
- Throws:
IOException
-
isEOF
returns true iff there's no more data to consume ...- Throws:
IOException
SAXException
-
getEncoding
Returns the name of the encoding in use, else null; the name returned is in as standard a form as we can get. -
getNameChar
returns the next name char, or NUL ... faster than getc(), and the common "name or nmtoken must be next" case won't need ungetc().- Throws:
IOException
SAXException
-
getc
gets the next Java character -- might be part of an XML text character represented by a surrogate pair, or be the end of the entity.- Throws:
IOException
SAXException
-
peekc
lookahead one character- Throws:
IOException
SAXException
-
ungetc
public void ungetc()two character pushback is guaranteed -
maybeWhitespace
optional grammatical whitespace (discarded)- Throws:
IOException
SAXException
-
parsedContent
normal content; whitespace in markup may be handled specially if the parser uses the content model.content terminates with markup delimiter characters, namely ampersand (&) and left angle bracket (<).
the document handler's characters() method is called on all the content found
- Throws:
IOException
SAXException
-
unparsedContent
public boolean unparsedContent(DTDEventListener docHandler, boolean ignorableWhitespace, String whitespaceInvalidMessage) throws IOException, SAXException CDATA -- character data, terminated by"]]>"
and optionally including unescaped markup delimiters (ampersand and left angle bracket). This should otherwise be exactly like character data, modulo differences in error report details.The document handler's characters() or ignorableWhitespace() methods are invoked on all the character data found
- Parameters:
docHandler
- gets callbacks for character dataignorableWhitespace
- if true, whitespace characters will be reported using docHandler.ignorableWhitespace(); implicitly, non-whitespace characters will cause validation errorswhitespaceInvalidMessage
- if true, ignorable whitespace causes a validity error report as well as a callback- Throws:
IOException
SAXException
-
checkSurrogatePair
- Throws:
SAXException
-
ignorableWhitespace
whitespace in markup (flagged to app, discardable)the document handler's ignorableWhitespace() method is called on all the whitespace found
- Throws:
IOException
SAXException
-
peek
returns false iff 'next' string isn't as provided, else skips that text and returns true.NOTE: two alternative string representations are both passed in, since one is faster.
- Throws:
IOException
SAXException
-
startRemembering
public void startRemembering() -
rememberText
-
getTopEntity
-
getPublicId
Returns the public ID of this input source, if known -
getSystemId
Returns the system ID of this input source, if known -
getLineNumber
public int getLineNumber()Returns the current line number in this input source -
getColumnNumber
public int getColumnNumber()returns -1; maintaining column numbers hurts performance -
fillbuf
- Throws:
IOException
SAXException
-
close
public void close() -
fatal
- Throws:
SAXException
-