|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.crimson.parser.InputEntity
This is how the parser talks to its input entities, of all kinds. The entities are in a stack.
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.
Field Summary | |
private char[] |
buf
|
private static int |
BUFSIZ
|
private org.xml.sax.ErrorHandler |
errHandler
|
private int |
finish
|
private org.xml.sax.InputSource |
input
|
private boolean |
isClosed
|
private boolean |
isPE
|
private int |
lineNumber
|
private Locale |
locale
|
private boolean |
maybeInCRLF
|
private String |
name
|
private static char[] |
newline
|
private InputEntity |
next
|
private Reader |
reader
|
private StringBuffer |
rememberedText
|
private boolean |
returnedFirstHalf
|
private int |
start
|
private int |
startRemember
|
Constructor Summary | |
private |
InputEntity()
|
Method Summary | |
private void |
checkRecursion(InputEntity stack)
|
private boolean |
checkSurrogatePair(int offset)
|
void |
close()
|
private static String |
convertToFileURL(String filename)
|
private void |
fatal(String messageId,
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 |
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(org.xml.sax.ErrorHandler h,
Locale l)
|
int |
getLineNumber()
Returns the current line number in this input source |
private org.xml.sax.Locator |
getLocator()
|
String |
getName()
|
char |
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(). |
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(org.xml.sax.ContentHandler handler)
whitespace in markup (flagged to app, discardable) the document handler's ignorableWhitespace() method is called on all the whitespace found |
void |
init(char[] b,
String name,
InputEntity stack,
boolean isPE)
|
void |
init(org.xml.sax.InputSource in,
String name,
InputEntity stack,
boolean isPE)
Use this for an external parsed entity |
boolean |
isDocument()
|
boolean |
isEOF()
returns true iff there's no more data to consume ... |
boolean |
isInternal()
|
boolean |
isParameterEntity()
|
(package private) boolean |
isXmlDeclOrTextDeclPrefix()
This method is used to disambiguate between XMLDecl, TextDecl, and PI by doing a lookahead w/o consuming any characters. |
boolean |
maybeWhitespace()
optional grammatical whitespace (discarded) |
boolean |
parsedContent(org.xml.sax.ContentHandler contentHandler,
ElementValidator validator)
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 NOTE: two alternative string representations are both passed in, since one is faster. |
boolean |
peekc(char c)
|
InputEntity |
pop()
|
String |
rememberText()
|
void |
startRemembering()
|
void |
ungetc()
two character pushback is guaranteed |
void |
unparsedContent(org.xml.sax.ContentHandler contentHandler,
ElementValidator validator,
boolean ignorableWhitespace,
String whitespaceInvalidMessage)
CDATA -- character data, terminated by "]]>" and optionally including unescaped markup delimiters (ampersand and left angle bracket). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int start
private int finish
private char[] buf
private int lineNumber
private boolean returnedFirstHalf
private boolean maybeInCRLF
private String name
private InputEntity next
private org.xml.sax.InputSource input
private Reader reader
private boolean isClosed
private org.xml.sax.ErrorHandler errHandler
private Locale locale
private StringBuffer rememberedText
private int startRemember
private boolean isPE
private static final int BUFSIZ
private static final char[] newline
Constructor Detail |
private InputEntity()
Method Detail |
public static InputEntity getInputEntity(org.xml.sax.ErrorHandler h, Locale l)
public boolean isInternal()
public boolean isDocument()
public boolean isParameterEntity()
public String getName()
private static String convertToFileURL(String filename)
public void init(org.xml.sax.InputSource in, String name, InputEntity stack, boolean isPE) throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public void init(char[] b, 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 IOException
IOException
public boolean isEOF() throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public String getEncoding()
public char getNameChar() throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public char getc() throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public boolean peekc(char c) throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public void ungetc()
public boolean maybeWhitespace() throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public boolean parsedContent(org.xml.sax.ContentHandler contentHandler, ElementValidator validator) throws 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
IOException
org.xml.sax.SAXException
public void unparsedContent(org.xml.sax.ContentHandler contentHandler, ElementValidator validator, boolean ignorableWhitespace, String whitespaceInvalidMessage) throws IOException, org.xml.sax.SAXException
The document handler's characters() or ignorableWhitespace() methods are invoked on all the character data found
contentHandler
- gets callbacks for character datavalidator
- text() or ignorableWhitespace() methods are
called appropriatelyignorableWhitespace
- if true, whitespace characters will
be reported using contentHandler.ignorableWhitespace(); implicitly,
non-whitespace characters will cause validation errors
IOException
org.xml.sax.SAXException
private boolean checkSurrogatePair(int offset) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public boolean ignorableWhitespace(org.xml.sax.ContentHandler handler) throws IOException, org.xml.sax.SAXException
the document handler's ignorableWhitespace() method is called on all the whitespace found
IOException
org.xml.sax.SAXException
public boolean peek(String next, char[] chars) throws IOException, org.xml.sax.SAXException
NOTE: two alternative string representations are both passed in, since one is faster.
IOException
org.xml.sax.SAXException
boolean isXmlDeclOrTextDeclPrefix() throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public void startRemembering()
public String rememberText()
private org.xml.sax.Locator getLocator()
public String getPublicId()
getPublicId
in interface org.xml.sax.Locator
public String getSystemId()
getSystemId
in interface org.xml.sax.Locator
public int getLineNumber()
getLineNumber
in interface org.xml.sax.Locator
public int getColumnNumber()
getColumnNumber
in interface org.xml.sax.Locator
private void fillbuf() throws IOException, org.xml.sax.SAXException
IOException
org.xml.sax.SAXException
public void close()
private void fatal(String messageId, Object[] params) throws org.xml.sax.SAXException
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |