Class CommentHandler
- java.lang.Object
-
- org.pentaho.reporting.libraries.xmlns.parser.CommentHandler
-
- All Implemented Interfaces:
LexicalHandler
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
Fields Modifier and Type Field Description static String
CLOSE_TAG_COMMENT
A constant marking a comment on the closing tag.static String
OPEN_TAG_COMMENT
A constant marking a comment on the opening tag.
-
Constructor Summary
Constructors Constructor Description CommentHandler()
DefaultConstructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearComments()
Clears all comments.void
comment(char[] ch, int start, int length)
Report an XML comment anywhere in the document.void
endCDATA()
Report the end of a CDATA section.void
endDTD()
Report the end of DTD declarations.void
endEntity(String name)
Report the end of an entity.String[]
getComments()
Returns all collected comments as string array.void
startCDATA()
Report the start of a CDATA section.void
startDTD(String name, String publicId, String systemId)
Report the start of DTD declarations, if any.void
startEntity(String name)
Report the beginning of some internal and external XML entities.
-
-
-
Field Detail
-
OPEN_TAG_COMMENT
public static final String OPEN_TAG_COMMENT
A constant marking a comment on the opening tag.- See Also:
- Constant Field Values
-
CLOSE_TAG_COMMENT
public static final String CLOSE_TAG_COMMENT
A constant marking a comment on the closing tag.- See Also:
- Constant Field Values
-
-
Method Detail
-
startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException
Report the start of DTD declarations, if any.This method is empty.
- Specified by:
startDTD
in interfaceLexicalHandler
- 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:
SAXException
- The application may raise an exception.- See Also:
endDTD()
,startEntity(String)
-
endDTD
public void endDTD() throws SAXException
Report the end of DTD declarations.This method is empty.
- Specified by:
endDTD
in interfaceLexicalHandler
- Throws:
SAXException
- The application may raise an exception.
-
startEntity
public void startEntity(String name) throws SAXException
Report the beginning of some internal and external XML entities.This method is empty.
- Specified by:
startEntity
in interfaceLexicalHandler
- 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(String)
,DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
-
endEntity
public void endEntity(String name) throws SAXException
Report the end of an entity.This method is empty.
- Specified by:
endEntity
in interfaceLexicalHandler
- Parameters:
name
- The name of the entity that is ending.- Throws:
SAXException
- The application may raise an exception.- See Also:
startEntity(String)
-
startCDATA
public void startCDATA() throws SAXException
Report the start of a CDATA section.This method is empty.
- Specified by:
startCDATA
in interfaceLexicalHandler
- Throws:
SAXException
- The application may raise an exception.- See Also:
endCDATA()
-
endCDATA
public void endCDATA() throws SAXException
Report the end of a CDATA section.This method is empty.
- Specified by:
endCDATA
in interfaceLexicalHandler
- Throws:
SAXException
- The application may raise an exception.- See Also:
startCDATA()
-
comment
public void comment(char[] ch, int start, int length) throws SAXException
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).
- Specified by:
comment
in interfaceLexicalHandler
- 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.
-
getComments
public String[] getComments()
Returns all collected comments as string array.- Returns:
- the array containing all comments.
-
clearComments
public void clearComments()
Clears all comments.
-
-