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 Object

## Field Summary

Fields
Modifier and Type
Field
Description
`protected Reader`
`source`

## Constructor Summary

Constructors
Constructor
Description
`DocumentParser(InputStream in)`
***** Public interface ***** *****
`DocumentParser(Reader src)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`callFlush(char[] buf, int offset, int length)`
Invokes flush().
`protected abstract void`
`comment(String s)`
This method inserts a comment It should be overridden by the subclass
`protected void`
`commentEOFError(int resetTo)`
`protected abstract void`
`doctype(String root, String publicId, String systemId)`
This method emits a doctype.
`protected abstract String`
`documentAttribute(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(String s)`
This method inserts a parse error string into the document It should be overridden by the subclass
`protected 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)`
`String`
`getDocumentSource()`
`protected char`
`handleCommentOrDoctype(char c)`
`protected void`
`initEntities()`
`void`
`parse()`
`protected char`
`parseEscape()`
`protected char`
`parseTag()`
`void`
`parseText()`
`protected abstract void`
`pi(String target, String data)`
This method emits a pi It should be overridden by the subclass
`protected char`
`readChar()`
`protected char`
`scanIdentifier(char c)`
`protected char`
`scanQuotedString(char c)`
`void`
`setInput(InputStream i, String encoding)`
`void`
`setInput(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(String name, TagProperties atts, boolean endTag, boolean emptyTag)`
This method emits a tag It should be overridden by the subclass

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### source

protected Reader source

## Constructor Details

### DocumentParser

public DocumentParser(InputStream in)
***** Public interface ***** *****

### DocumentParser

public DocumentParser(Reader src)

## Method Details

### setInput

public void setInput(Reader src)

### setInput

public void setInput(InputStream i, String encoding) throws UnsupportedEncodingException

Throws:
  `UnsupportedEncodingException`

### setShouldCacheSource

public void setShouldCacheSource(boolean state)

### getDocumentSource

public String getDocumentSource()

### parse

public void parse() throws IOException

Throws:
  `IOException`

### parseText

public void parseText() throws IOException

Throws:
  `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(String s)
This method inserts a comment It should be overridden by the subclass

### tag

protected abstract void tag(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(String target, String data)
This method emits a pi It should be overridden by the subclass

### doctype

protected abstract void doctype(String root, String publicId, String systemId)
This method emits a doctype. Internal subset information is discarded It should be overridden by the subclass

### documentAttribute

protected abstract String documentAttribute(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(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 IOException

Throws:
  `IOException`

### handleCommentOrDoctype

protected char handleCommentOrDoctype(char c) throws IOException

Throws:
  `IOException`

### setXmlEntities

protected void setXmlEntities(TagProperties attr)

### parseTag

protected char parseTag() throws IOException

Throws:
  `IOException`

### parseEscape

protected char parseEscape() throws IOException

Throws:
  `IOException`

### initEntities

protected void initEntities()

### scanIdentifier

protected char scanIdentifier(char c) throws IOException

Throws:
  `IOException`

### scanQuotedString

protected char scanQuotedString(char c) throws IOException

Throws:
  `IOException`

### skipWhite

protected char skipWhite(char c) throws IOException

Throws:
  `IOException`

### readChar

protected char readChar() throws IOException

Throws:
  `IOException`

### skipToCloseAngle

protected void skipToCloseAngle(char c) throws 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:
  `IOException`

### generateError

protected void generateError(int offset)

### commentEOFError

protected void commentEOFError(int resetTo)

### eofError

protected void eofError()