Class FlattenMojo.SaxHeaderCommentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.xml.sax.ext.DefaultHandler2
org.codehaus.mojo.flatten.FlattenMojo.SaxHeaderCommentHandler
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, EntityResolver2, LexicalHandler
- Enclosing class:
FlattenMojo
This class is a simple SAX handler that extracts the first comment located before the root tag in an XML
document.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate booleantrueif root tag has already been visited,falseotherwise. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomment(char[] ch, int start, int length) voidstartElement(String uri, String localName, String qName, Attributes attrs) Methods inherited from class DefaultHandler2
attributeDecl, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntityMethods inherited from class DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
Field Details
-
rootTagSeen
private boolean rootTagSeentrueif root tag has already been visited,falseotherwise. -
headerComment
- See Also:
-
-
Constructor Details
-
SaxHeaderCommentHandler
SaxHeaderCommentHandler()The constructor.
-
-
Method Details
-
getHeaderComment
- Returns:
- the XML comment from the header of the document or
nullif not present.
-
comment
public void comment(char[] ch, int start, int length) - Specified by:
commentin interfaceLexicalHandler- Overrides:
commentin classDefaultHandler2
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler
-