Package org.codehaus.mojo.flatten
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 String
private boolean
true
if root tag has already been visited,false
otherwise. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
comment
(char[] ch, int start, int length) void
startElement
(String uri, String localName, String qName, Attributes atts) Methods inherited from class org.xml.sax.ext.DefaultHandler2
attributeDecl, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
Field Details
-
rootTagSeen
private boolean rootTagSeentrue
if root tag has already been visited,false
otherwise. -
headerComment
- See Also:
-
-
Constructor Details
-
SaxHeaderCommentHandler
SaxHeaderCommentHandler()The constructor.
-
-
Method Details
-
getHeaderComment
- Returns:
- the XML comment from the header of the document or
null
if not present.
-
comment
- Specified by:
comment
in interfaceLexicalHandler
- Overrides:
comment
in classDefaultHandler2
- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-