Package com.sun.java.help.impl
Class DocumentParser
- java.lang.Object
-
- com.sun.java.help.impl.DocumentParser
-
- Direct Known Subclasses:
Parser
public abstract class DocumentParser extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.Reader
source
-
Constructor Summary
Constructors Constructor Description DocumentParser(java.io.InputStream in)
***** Public interface ***** *****DocumentParser(java.io.Reader src)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
callFlush(char[] buf, int offset, int length)
Invokes flush().protected abstract void
comment(java.lang.String s)
This method inserts a comment It should be overridden by the subclassprotected void
commentEOFError(int resetTo)
protected abstract void
doctype(java.lang.String root, java.lang.String publicId, java.lang.String systemId)
This method emits a doctype.protected abstract java.lang.String
documentAttribute(java.lang.String name)
This method looks up a &xxx; sequence in the document properties (this is used for templates).protected void
eofError()
protected abstract void
errorString(java.lang.String s)
This method inserts a parse error string into the document It should be overridden by the subclassprotected void
findCloseAngleForComment(char c)
protected abstract void
flush(char[] buf, int offset, int length)
This method creates a block of text for a document.protected void
generateError(int offset)
java.lang.String
getDocumentSource()
protected char
handleCommentOrDoctype(char c)
protected void
initEntities()
void
parse()
protected char
parseEscape()
protected char
parseTag()
void
parseText()
protected abstract void
pi(java.lang.String target, java.lang.String data)
This method emits a pi It should be overridden by the subclassprotected char
readChar()
protected char
scanIdentifier(char c)
protected char
scanQuotedString(char c)
void
setInput(java.io.InputStream i, java.lang.String encoding)
void
setInput(java.io.Reader src)
void
setShouldCacheSource(boolean state)
protected void
setXmlEntities(TagProperties attr)
protected void
skipToCloseAngle(char c)
This method is called when parsing a tag and an error is encountered.protected char
skipWhite(char c)
protected abstract void
tag(java.lang.String name, TagProperties atts, boolean endTag, boolean emptyTag)
This method emits a tag It should be overridden by the subclass
-
-
-
Method Detail
-
setInput
public void setInput(java.io.Reader src)
-
setInput
public void setInput(java.io.InputStream i, java.lang.String encoding) throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
-
setShouldCacheSource
public void setShouldCacheSource(boolean state)
-
getDocumentSource
public java.lang.String getDocumentSource()
-
parse
public void parse() throws java.io.IOException
- Throws:
java.io.IOException
-
parseText
public void parseText() throws java.io.IOException
- Throws:
java.io.IOException
-
callFlush
protected void callFlush(char[] buf, int offset, int length)
Invokes flush(). This method is provided so that flush() can be protected
-
flush
protected abstract void flush(char[] buf, int offset, int length)
This method creates a block of text for a document. It should be overridden by the subclass
-
comment
protected abstract void comment(java.lang.String s)
This method inserts a comment It should be overridden by the subclass
-
tag
protected abstract void tag(java.lang.String name, TagProperties atts, boolean endTag, boolean emptyTag)
This method emits a tag It should be overridden by the subclass
-
pi
protected abstract void pi(java.lang.String target, java.lang.String data)
This method emits a pi It should be overridden by the subclass
-
doctype
protected abstract void doctype(java.lang.String root, java.lang.String publicId, java.lang.String systemId)
This method emits a doctype. Internal subset information is discarded It should be overridden by the subclass
-
documentAttribute
protected abstract java.lang.String documentAttribute(java.lang.String name)
This method looks up a &xxx; sequence in the document properties (this is used for templates). A return of null means the proerty is undefined. It should be overridden by the subclass
-
errorString
protected abstract void errorString(java.lang.String s)
This method inserts a parse error string into the document It should be overridden by the subclass
-
findCloseAngleForComment
protected void findCloseAngleForComment(char c) throws java.io.IOException
- Throws:
java.io.IOException
-
handleCommentOrDoctype
protected char handleCommentOrDoctype(char c) throws java.io.IOException
- Throws:
java.io.IOException
-
setXmlEntities
protected void setXmlEntities(TagProperties attr)
-
parseTag
protected char parseTag() throws java.io.IOException
- Throws:
java.io.IOException
-
parseEscape
protected char parseEscape() throws java.io.IOException
- Throws:
java.io.IOException
-
initEntities
protected void initEntities()
-
scanIdentifier
protected char scanIdentifier(char c) throws java.io.IOException
- Throws:
java.io.IOException
-
scanQuotedString
protected char scanQuotedString(char c) throws java.io.IOException
- Throws:
java.io.IOException
-
skipWhite
protected char skipWhite(char c) throws java.io.IOException
- Throws:
java.io.IOException
-
readChar
protected char readChar() throws java.io.IOException
- Throws:
java.io.IOException
-
skipToCloseAngle
protected void skipToCloseAngle(char c) throws java.io.IOException
This method is called when parsing a tag and an error is encountered. It skips to the closing angle bracket, treating the entire tag as error text. The generateError call at the end stuffs the full tag into the document as an error.- Throws:
java.io.IOException
-
generateError
protected void generateError(int offset)
-
commentEOFError
protected void commentEOFError(int resetTo)
-
eofError
protected void eofError()
-
-