Class Parser
- All Implemented Interfaces:
Serializable, Cloneable, Configuration, ContentHandler, DTDHandler, EntityResolver, ErrorHandler
An initial report definition handler must be set before the parser can be used.
- Author:
- Thomas Morgner
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Receive notification of character data inside an element.voidReceive notification of the end of the document.voidendElement(String uri, String localName, String qName) Receive notification of the end of an element.String[]Returns the currently collected comments.getHelperObject(String key) Returns a helper object.Returns the initial handler.abstract ParserReturns a new instance of the parser.abstract ObjectReturns the parsed result object after the parsing is complete.final FrontendDefaultHandlerReturns a new instance ofFrontendDefaultHandler.Reads a handler off the stack without removing it.Pops a handler from the stack.voidpushFactory(ElementDefinitionHandler factory) Pushes a handler onto the stack.voidsetHelperObject(String key, Object value) Sets a helper object.voidSets the initial handler.voidReceive notification of the beginning of the document.voidstartElement(String uri, String localName, String qName, Attributes attributes) Receive notification of the start of an element.Methods inherited from class FrontendDefaultHandler
clone, findPropertyKeys, getCommentHandler, getConfigProperties, getConfigProperty, getConfigProperty, getContentBase, getLocator, setConfigProperty, setDocumentLocatorMethods inherited from class DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Field Details
-
CONTENTBASE_KEY
-
-
Constructor Details
-
Parser
public Parser()Creates a new parser.
-
-
Method Details
-
getComments
-
pushFactory
Pushes a handler onto the stack.- Parameters:
factory- the handler.
-
peekFactory
Reads a handler off the stack without removing it.- Returns:
- The handler.
-
popFactory
-
endDocument
Receive notification of the end of the document.By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
startDocument
Receive notification of the beginning of the document.By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
characters
Receive notification of character data inside an element.By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- the characters.start- the start position in the character array.length- the number of characters to use from the character array.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
endElement
Receive notification of the end of an element.By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
uri- the URI.localName- the element type name.qName- the name.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException Receive notification of the start of an element.By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
uri- the URI.localName- the element type name.qName- the name.attributes- the specified or defaulted attributes.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
setInitialFactory
Sets the initial handler.- Parameters:
factory- the initial handler.
-
getInitialFactory
Returns the initial handler.- Returns:
- The initial handler.
-
setHelperObject
Sets a helper object.- Parameters:
key- the key.value- the value.
-
getHelperObject
Returns a helper object.- Parameters:
key- the key.- Returns:
- The object.
-
getInstance
Returns a new instance of the parser.- Returns:
- a new instance of the parser.
-
newInstance
Returns a new instance ofFrontendDefaultHandler.- Specified by:
newInstancein classFrontendDefaultHandler- Returns:
- A new instance.
-
getResult
Returns the parsed result object after the parsing is complete. Calling this function during the parsing is undefined and may result in an IllegalStateException.- Specified by:
getResultin classFrontendDefaultHandler- Returns:
- the parsed result.
-