org.pentaho.reporting.libraries.xmlns.parser

Class CommentHandler

public class CommentHandler extends Object implements LexicalHandler

The comment handler is used to collect all XML comments from the SAX parser. The parser implementation must support comments to make this feature work.

Author: Thomas Morgner

Field Summary
static StringCLOSE_TAG_COMMENT
A constant marking a comment on the closing tag.
static StringOPEN_TAG_COMMENT
A constant marking a comment on the opening tag.
Constructor Summary
CommentHandler()
DefaultConstructor.
Method Summary
voidclearComments()
Clears all comments.
voidcomment(char[] ch, int start, int length)
Report an XML comment anywhere in the document.
voidendCDATA()
Report the end of a CDATA section.
voidendDTD()
Report the end of DTD declarations.
voidendEntity(String name)
Report the end of an entity.
String[]getComments()
Returns all collected comments as string array.
voidstartCDATA()
Report the start of a CDATA section.
voidstartDTD(String name, String publicId, String systemId)
Report the start of DTD declarations, if any.
voidstartEntity(String name)
Report the beginning of some internal and external XML entities.

Field Detail

CLOSE_TAG_COMMENT

public static final String CLOSE_TAG_COMMENT
A constant marking a comment on the closing tag.

OPEN_TAG_COMMENT

public static final String OPEN_TAG_COMMENT
A constant marking a comment on the opening tag.

Constructor Detail

CommentHandler

public CommentHandler()
DefaultConstructor.

Method Detail

clearComments

public void clearComments()
Clears all comments.

comment

public void comment(char[] ch, int start, int length)
Report an XML comment anywhere in the document.

This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).

Parameters: ch An array holding the characters in the comment. start The starting position in the array. length The number of characters to use from the array.

Throws: SAXException The application may raise an exception.

endCDATA

public void endCDATA()
Report the end of a CDATA section.

This method is empty.

Throws: SAXException The application may raise an exception.

See Also: startCDATA

endDTD

public void endDTD()
Report the end of DTD declarations.

This method is empty.

Throws: SAXException The application may raise an exception.

endEntity

public void endEntity(String name)
Report the end of an entity.

This method is empty.

Parameters: name The name of the entity that is ending.

Throws: SAXException The application may raise an exception.

See Also: startEntity

getComments

public String[] getComments()
Returns all collected comments as string array.

Returns: the array containing all comments.

startCDATA

public void startCDATA()
Report the start of a CDATA section.

This method is empty.

Throws: SAXException The application may raise an exception.

See Also: endCDATA

startDTD

public void startDTD(String name, String publicId, String systemId)
Report the start of DTD declarations, if any.

This method is empty.

Parameters: name The document type name. publicId The declared public identifier for the external DTD subset, or null if none was declared. systemId The declared system identifier for the external DTD subset, or null if none was declared.

Throws: org.xml.sax.SAXException The application may raise an exception.

See Also: endDTD startEntity

startEntity

public void startEntity(String name)
Report the beginning of some internal and external XML entities.

This method is empty.

Parameters: name The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".

Throws: SAXException The application may raise an exception.

See Also: endEntity org.xml.sax.ext.DeclHandler#internalEntityDecl org.xml.sax.ext.DeclHandler#externalEntityDecl