public class InputEntity
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
private char[] |
buf |
private static int |
BUFSIZ |
private DTDEventListener |
errHandler |
private int |
finish |
private org.xml.sax.InputSource |
input |
private boolean |
isClosed |
private boolean |
isPE |
private int |
lineNumber |
private java.util.Locale |
locale |
private boolean |
maybeInCRLF |
private java.lang.String |
name |
private static char[] |
newline |
private InputEntity |
next |
private java.io.Reader |
reader |
private java.lang.StringBuffer |
rememberedText |
private boolean |
returnedFirstHalf |
private int |
start |
private int |
startRemember |
Modifier | Constructor and Description |
---|---|
private |
InputEntity() |
Modifier and Type | Method and Description |
---|---|
private void |
checkRecursion(InputEntity stack) |
private boolean |
checkSurrogatePair(int offset) |
void |
close() |
private void |
fatal(java.lang.String messageId,
java.lang.Object[] params) |
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 |
getColumnNumber()
returns -1; maintaining column numbers hurts performance
|
java.lang.String |
getEncoding()
Returns the name of the encoding in use, else null; the name
returned is in as standard a form as we can get.
|
static InputEntity |
getInputEntity(DTDEventListener h,
java.util.Locale l) |
int |
getLineNumber()
Returns the current line number in this input source
|
java.lang.String |
getName() |
char |
getNameChar()
returns the next name char, or NUL ...
|
java.lang.String |
getPublicId()
Returns the public ID of this input source, if known
|
java.lang.String |
getSystemId()
Returns the system ID of this input source, if known
|
private InputEntity |
getTopEntity() |
boolean |
ignorableWhitespace(DTDEventListener handler)
whitespace in markup (flagged to app, discardable)
|
void |
init(char[] b,
java.lang.String name,
InputEntity stack,
boolean isPE) |
void |
init(org.xml.sax.InputSource in,
java.lang.String name,
InputEntity stack,
boolean isPE) |
boolean |
isDocument() |
boolean |
isEOF()
returns true iff there's no more data to consume ...
|
boolean |
isInternal() |
boolean |
isParameterEntity() |
boolean |
maybeWhitespace()
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 |
peek(java.lang.String next,
char[] chars)
returns false iff 'next' string isn't as provided,
else skips that text and returns true.
|
boolean |
peekc(char c)
lookahead one character
|
InputEntity |
pop() |
java.lang.String |
rememberText() |
void |
startRemembering() |
void |
ungetc()
two character pushback is guaranteed
|
boolean |
unparsedContent(DTDEventListener docHandler,
boolean ignorableWhitespace,
java.lang.String whitespaceInvalidMessage)
CDATA -- character data, terminated by "]]>" and optionally
including unescaped markup delimiters (ampersand and left angle
bracket).
|
private int start
private int finish
private char[] buf
private int lineNumber
private boolean returnedFirstHalf
private boolean maybeInCRLF
private java.lang.String name
private InputEntity next
private org.xml.sax.InputSource input
private java.io.Reader reader
private boolean isClosed
private DTDEventListener errHandler
private java.util.Locale locale
private java.lang.StringBuffer rememberedText
private int startRemember
private boolean isPE
private static final int BUFSIZ
private static final char[] newline
public static InputEntity getInputEntity(DTDEventListener h, java.util.Locale l)
public boolean isInternal()
public boolean isDocument()
public boolean isParameterEntity()
public java.lang.String getName()
public void init(org.xml.sax.InputSource in, java.lang.String name, InputEntity stack, boolean isPE) throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public void init(char[] b, java.lang.String name, InputEntity stack, boolean isPE) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void checkRecursion(InputEntity stack) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public InputEntity pop() throws java.io.IOException
java.io.IOException
public boolean isEOF() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public java.lang.String getEncoding()
public char getNameChar() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public char getc() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public boolean peekc(char c) throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public void ungetc()
public boolean maybeWhitespace() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public boolean parsedContent(DTDEventListener docHandler) throws java.io.IOException, org.xml.sax.SAXException
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
java.io.IOException
org.xml.sax.SAXException
public boolean unparsedContent(DTDEventListener docHandler, boolean ignorableWhitespace, java.lang.String whitespaceInvalidMessage) throws java.io.IOException, org.xml.sax.SAXException
The document handler's characters() or ignorableWhitespace() methods are invoked on all the character data found
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 callbackjava.io.IOException
org.xml.sax.SAXException
private boolean checkSurrogatePair(int offset) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public boolean ignorableWhitespace(DTDEventListener handler) throws java.io.IOException, org.xml.sax.SAXException
the document handler's ignorableWhitespace() method is called on all the whitespace found
java.io.IOException
org.xml.sax.SAXException
public boolean peek(java.lang.String next, char[] chars) throws java.io.IOException, org.xml.sax.SAXException
NOTE: two alternative string representations are both passed in, since one is faster.
java.io.IOException
org.xml.sax.SAXException
public void startRemembering()
public java.lang.String rememberText()
private InputEntity getTopEntity()
public java.lang.String getPublicId()
public java.lang.String getSystemId()
public int getLineNumber()
public int getColumnNumber()
private void fillbuf() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public void close()
private void fatal(java.lang.String messageId, java.lang.Object[] params) throws org.xml.sax.SAXException
org.xml.sax.SAXException