com.sun.msv.scanner.dtd

Class InputEntity

public class InputEntity extends Object

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.

Version: 1.4 00/08/05

Author: David Brownell Janet Koenig

Method Summary
voidclose()
chargetc()
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.
intgetColumnNumber()
returns -1; maintaining column numbers hurts performance
StringgetEncoding()
Returns the name of the encoding in use, else null; the name returned is in as standard a form as we can get.
static InputEntitygetInputEntity(DTDEventListener h, Locale l)
intgetLineNumber()
Returns the current line number in this input source
StringgetName()
chargetNameChar()
returns the next name char, or NUL ... faster than getc(), and the common "name or nmtoken must be next" case won't need ungetc().
StringgetPublicId()
Returns the public ID of this input source, if known
StringgetSystemId()
Returns the system ID of this input source, if known
booleanignorableWhitespace(DTDEventListener handler)
whitespace in markup (flagged to app, discardable)

the document handler's ignorableWhitespace() method is called on all the whitespace found

voidinit(InputSource in, String name, InputEntity stack, boolean isPE)
voidinit(char[] b, String name, InputEntity stack, boolean isPE)
booleanisDocument()
booleanisEOF()
returns true iff there's no more data to consume ...
booleanisInternal()
booleanisParameterEntity()
booleanmaybeWhitespace()
optional grammatical whitespace (discarded)
booleanparsedContent(DTDEventListener docHandler)
normal content; whitespace in markup may be handled specially if the parser uses the content model.
booleanpeek(String next, char[] chars)
returns false iff 'next' string isn't as provided, else skips that text and returns true.
booleanpeekc(char c)
lookahead one character
InputEntitypop()
StringrememberText()
voidstartRemembering()
voidungetc()
two character pushback is guaranteed
booleanunparsedContent(DTDEventListener docHandler, boolean ignorableWhitespace, String whitespaceInvalidMessage)
CDATA -- character data, terminated by "]]>" and optionally including unescaped markup delimiters (ampersand and left angle bracket).

Method Detail

close

public void close()

getc

public 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.

getColumnNumber

public int getColumnNumber()
returns -1; maintaining column numbers hurts performance

getEncoding

public 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.

getInputEntity

public static InputEntity getInputEntity(DTDEventListener h, Locale l)

getLineNumber

public int getLineNumber()
Returns the current line number in this input source

getName

public String getName()

getNameChar

public 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().

getPublicId

public String getPublicId()
Returns the public ID of this input source, if known

getSystemId

public String getSystemId()
Returns the system ID of this input source, if known

ignorableWhitespace

public boolean ignorableWhitespace(DTDEventListener handler)
whitespace in markup (flagged to app, discardable)

the document handler's ignorableWhitespace() method is called on all the whitespace found

init

public void init(InputSource in, String name, InputEntity stack, boolean isPE)

init

public void init(char[] b, String name, InputEntity stack, boolean isPE)

isDocument

public boolean isDocument()

isEOF

public boolean isEOF()
returns true iff there's no more data to consume ...

isInternal

public boolean isInternal()

isParameterEntity

public boolean isParameterEntity()

maybeWhitespace

public boolean maybeWhitespace()
optional grammatical whitespace (discarded)

parsedContent

public boolean parsedContent(DTDEventListener docHandler)
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

peek

public 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.

peekc

public boolean peekc(char c)
lookahead one character

pop

public InputEntity pop()

rememberText

public String rememberText()

startRemembering

public void startRemembering()

ungetc

public void ungetc()
two character pushback is guaranteed

unparsedContent

public boolean unparsedContent(DTDEventListener docHandler, boolean ignorableWhitespace, String whitespaceInvalidMessage)
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 data ignorableWhitespace if true, whitespace characters will be reported using docHandler.ignorableWhitespace(); implicitly, non-whitespace characters will cause validation errors whitespaceInvalidMessage if true, ignorable whitespace causes a validity error report as well as a callback