Top Description Fields Constructors Methods
com.sun.msv.scanner.dtd

public Class InputEntity

extends Object
Class Inheritance
Imports
java.io.CharConversionException, .IOException, .InputStream, .InputStreamReader, .Reader, .UnsupportedEncodingException, java.net.URL, java.util.Locale, org.xml.sax.InputSource, .SAXException, .SAXParseException

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.

Authors
David Brownell, Janet Koenig
Version
1.4 00/08/05

Field Summary

Modifier and TypeField and Description
private 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

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
private boolean
checkSurrogatePair(int offset)

public void
private void
fatal(String messageId, Object[] params)

private void
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.

public int
getColumnNumber()

returns -1; maintaining column numbers hurts performance

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.

public static InputEntity
public int
getLineNumber()

Returns the current line number in this input source

public String
public char
getNameChar()

returns the next name char, or NUL ...

public String
getPublicId()

Returns the public ID of this input source, if known

public String
getSystemId()

Returns the system ID of this input source, if known

private InputEntity
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

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

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

public boolean
public boolean
isEOF()

returns true iff there's no more data to consume ...

public boolean
public boolean
public boolean
maybeWhitespace()

optional grammatical whitespace (discarded)

public boolean
parsedContent(DTDEventListener docHandler)

normal content; whitespace in markup may be handled specially if the parser uses the content model.

public boolean
peek(String next, char[] chars)

returns false iff 'next' string isn't as provided, else skips that text and returns true.

public boolean
peekc(char c)

lookahead one character

public InputEntity
pop()

public String
public void
public void
ungetc()

two character pushback is guaranteed

public boolean
unparsedContent(DTDEventListener
gets callbacks for character data
docHandler
,
boolean
if true, whitespace characters will be reported using docHandler.ignorableWhitespace(); implicitly, non-whitespace characters will cause validation errors
ignorableWhitespace
,
String
if true, ignorable whitespace causes a validity error report as well as a callback
whitespaceInvalidMessage
)

CDATA -- character data, terminated by "]]>" and optionally including unescaped markup delimiters (ampersand and left angle bracket).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private char[] buf
BUFSIZback to summary
private static final int BUFSIZ
errHandlerback to summary
private DTDEventListener errHandler
finishback to summary
private int finish
inputback to summary
private InputSource input
isClosedback to summary
private boolean isClosed
isPEback to summary
private boolean isPE
lineNumberback to summary
private int lineNumber
localeback to summary
private Locale locale
maybeInCRLFback to summary
private boolean maybeInCRLF
nameback to summary
private String name
newlineback to summary
private static final char[] newline
nextback to summary
private InputEntity next
readerback to summary
private Reader reader
rememberedTextback to summary
private StringBuffer rememberedText
returnedFirstHalfback to summary
private boolean returnedFirstHalf
startback to summary
private int start
startRememberback to summary
private int startRemember

Constructor Detail

InputEntityback to summary
private InputEntity()

Method Detail

checkRecursionback to summary
private void checkRecursion(InputEntity stack) throws SAXException
checkSurrogatePairback to summary
private boolean checkSurrogatePair(int offset) throws SAXException
closeback to summary
public void close()
fatalback to summary
private void fatal(String messageId, Object[] params) throws SAXException
fillbufback to summary
private void fillbuf() throws IOException, SAXException
getcback to summary
public char getc() throws IOException, SAXException

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.

getColumnNumberback to summary
public int getColumnNumber()

returns -1; maintaining column numbers hurts performance

getEncodingback to summary
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.

getInputEntityback to summary
public static InputEntity getInputEntity(DTDEventListener h, Locale l)
getLineNumberback to summary
public int getLineNumber()

Returns the current line number in this input source

getNameback to summary
public String getName()
getNameCharback to summary
public char getNameChar() throws IOException, SAXException

returns the next name char, or NUL ... faster than getc(), and the common "name or nmtoken must be next" case won't need ungetc().

getPublicIdback to summary
public String getPublicId()

Returns the public ID of this input source, if known

getSystemIdback to summary
public String getSystemId()

Returns the system ID of this input source, if known

getTopEntityback to summary
private InputEntity getTopEntity()
ignorableWhitespaceback to summary
public boolean ignorableWhitespace(DTDEventListener handler) throws IOException, SAXException

whitespace in markup (flagged to app, discardable)

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

initback to summary
public void init(InputSource in, String name, InputEntity stack, boolean isPE) throws IOException, SAXException
initback to summary
public void init(char[] b, String name, InputEntity stack, boolean isPE) throws SAXException
isDocumentback to summary
public boolean isDocument()
isEOFback to summary
public boolean isEOF() throws IOException, SAXException

returns true iff there's no more data to consume ...

isInternalback to summary
public boolean isInternal()
isParameterEntityback to summary
public boolean isParameterEntity()
maybeWhitespaceback to summary
public boolean maybeWhitespace() throws IOException, SAXException

optional grammatical whitespace (discarded)

parsedContentback to summary
public boolean parsedContent(DTDEventListener docHandler) throws IOException, SAXException

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

peekback to summary
public boolean peek(String next, char[] chars) throws IOException, SAXException

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.

peekcback to summary
public boolean peekc(char c) throws IOException, SAXException

lookahead one character

popback to summary
public InputEntity pop() throws IOException
rememberTextback to summary
public String rememberText()
startRememberingback to summary
public void startRemembering()
ungetcback to summary
public void ungetc()

two character pushback is guaranteed

unparsedContentback to summary
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:DTDEventListener

gets callbacks for character data

ignorableWhitespace:boolean

if true, whitespace characters will be reported using docHandler.ignorableWhitespace(); implicitly, non-whitespace characters will cause validation errors

whitespaceInvalidMessage:String

if true, ignorable whitespace causes a validity error report as well as a callback