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.Readersource
-
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 voidcallFlush(char[] buf, int offset, int length)Invokes flush().protected abstract voidcomment(java.lang.String s)This method inserts a comment It should be overridden by the subclassprotected voidcommentEOFError(int resetTo)protected abstract voiddoctype(java.lang.String root, java.lang.String publicId, java.lang.String systemId)This method emits a doctype.protected abstract java.lang.StringdocumentAttribute(java.lang.String name)This method looks up a &xxx; sequence in the document properties (this is used for templates).protected voideofError()protected abstract voiderrorString(java.lang.String s)This method inserts a parse error string into the document It should be overridden by the subclassprotected voidfindCloseAngleForComment(char c)protected abstract voidflush(char[] buf, int offset, int length)This method creates a block of text for a document.protected voidgenerateError(int offset)java.lang.StringgetDocumentSource()protected charhandleCommentOrDoctype(char c)protected voidinitEntities()voidparse()protected charparseEscape()protected charparseTag()voidparseText()protected abstract voidpi(java.lang.String target, java.lang.String data)This method emits a pi It should be overridden by the subclassprotected charreadChar()protected charscanIdentifier(char c)protected charscanQuotedString(char c)voidsetInput(java.io.InputStream i, java.lang.String encoding)voidsetInput(java.io.Reader src)voidsetShouldCacheSource(boolean state)protected voidsetXmlEntities(TagProperties attr)protected voidskipToCloseAngle(char c)This method is called when parsing a tag and an error is encountered.protected charskipWhite(char c)protected abstract voidtag(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.IOExceptionThis 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()
-
-