public class InputEntity extends 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 | Method and Description |
---|---|
void |
close() |
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
|
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,
Locale l) |
int |
getLineNumber()
Returns the current line number in this input source
|
String |
getName() |
char |
getNameChar()
returns the next name char, or NUL ...
|
String |
getPublicId()
Returns the public ID of this input source, if known
|
String |
getSystemId()
Returns the system ID of this input source, if known
|
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 |
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(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() |
String |
rememberText() |
void |
startRemembering() |
void |
ungetc()
two character pushback is guaranteed
|
boolean |
unparsedContent(DTDEventListener docHandler,
boolean ignorableWhitespace,
String whitespaceInvalidMessage)
CDATA -- character data, terminated by "]]>" and optionally
including unescaped markup delimiters (ampersand and left angle
bracket).
|
public static InputEntity getInputEntity(DTDEventListener h, Locale l)
public boolean isInternal()
public boolean isDocument()
public boolean isParameterEntity()
public String getName()
public void init(InputSource in, String name, InputEntity stack, boolean isPE) throws IOException, SAXException
IOException
SAXException
public void init(char[] b, String name, InputEntity stack, boolean isPE) throws SAXException
SAXException
public InputEntity pop() throws IOException
IOException
public boolean isEOF() throws IOException, SAXException
IOException
SAXException
public String getEncoding()
public char getNameChar() throws IOException, SAXException
IOException
SAXException
public char getc() throws IOException, SAXException
IOException
SAXException
public boolean peekc(char c) throws IOException, SAXException
IOException
SAXException
public void ungetc()
public boolean maybeWhitespace() throws IOException, SAXException
IOException
SAXException
public boolean parsedContent(DTDEventListener docHandler) throws IOException, 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
IOException
SAXException
public boolean unparsedContent(DTDEventListener docHandler, boolean ignorableWhitespace, String whitespaceInvalidMessage) throws IOException, 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 callbackIOException
SAXException
public boolean ignorableWhitespace(DTDEventListener handler) throws IOException, SAXException
the document handler's ignorableWhitespace() method is called on all the whitespace found
IOException
SAXException
public boolean peek(String next, char[] chars) throws IOException, SAXException
NOTE: two alternative string representations are both passed in, since one is faster.
IOException
SAXException
public void startRemembering()
public String rememberText()
public String getPublicId()
public String getSystemId()
public int getLineNumber()
public int getColumnNumber()
public void close()
Copyright © 2016 Oracle Corporation. All rights reserved.