Class ParserHandler

  • All Implemented Interfaces:
    ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, EntityResolver2, LexicalHandler
    Direct Known Subclasses:
    StreamingParserHandler

    public class ParserHandler
    extends DefaultHandler2
    The main sax event handler used for parsing the input document. This handler maintains a stack of Handler objects. A handler is purshed onto the stack when a startElement event is processed, and popped off the stack when the corresponding endElement event is processed.
    Author:
    Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net
    • Field Detail

      • handlers

        protected Stack<Handler> handlers
        execution stack *
    • Constructor Detail

    • Method Detail

      • setStrict

        public void setStrict​(boolean strict)
      • isStrict

        public boolean isStrict()
      • isValidating

        public boolean isValidating()
      • setValidating

        public void setValidating​(boolean validating)
      • setFailOnValidationError

        public void setFailOnValidationError​(boolean failOnValidationError)
      • isFailOnValidationError

        public boolean isFailOnValidationError()
      • setHandleMixedContent

        public void setHandleMixedContent​(boolean handleMixedContent)
      • isHandleMixedContent

        public boolean isHandleMixedContent()
      • setForceParserDelegate

        public void setForceParserDelegate​(boolean forceParserDelegate)
      • isForceParserDelegate

        public boolean isForceParserDelegate()
      • setRootElementType

        public void setRootElementType​(QName rootElementType)
      • getRootElementType

        public QName getRootElementType()
      • getValidationErrors

        public List<Exception> getValidationErrors()
      • getSchemas

        public XSDSchema[] getSchemas()
      • getLogger

        public Logger getLogger()
      • getURIHandlers

        public List<URIHandler> getURIHandlers()
      • setEntityResolver

        public void setEntityResolver​(EntityResolver entityResolver)
      • getEntityResolver

        public EntityResolver getEntityResolver()
      • resolveEntity

        public InputSource resolveEntity​(String publicId,
                                         String systemId)
                                  throws IOException,
                                         SAXException
        Specified by:
        resolveEntity in interface EntityResolver
        Overrides:
        resolveEntity in class DefaultHandler2
        Throws:
        IOException
        SAXException
      • resolveEntity

        public InputSource resolveEntity​(String name,
                                         String publicId,
                                         String baseURI,
                                         String systemId)
                                  throws SAXException,
                                         IOException
        Specified by:
        resolveEntity in interface EntityResolver2
        Overrides:
        resolveEntity in class DefaultHandler2
        Throws:
        SAXException
        IOException
      • startPrefixMapping

        public void startPrefixMapping​(String prefix,
                                       String uri)
                                throws SAXException
        Specified by:
        startPrefixMapping in interface ContentHandler
        Overrides:
        startPrefixMapping in class DefaultHandler
        Throws:
        SAXException
      • startDocument

        public void startDocument()
                           throws SAXException
        Specified by:
        startDocument in interface ContentHandler
        Overrides:
        startDocument in class DefaultHandler
        Throws:
        SAXException
      • startElement

        public void startElement​(String uri,
                                 String localName,
                                 String qName,
                                 Attributes attributes)
                          throws SAXException
        Specified by:
        startElement in interface ContentHandler
        Overrides:
        startElement in class DefaultHandler
        Throws:
        SAXException
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws SAXException
        Specified by:
        characters in interface ContentHandler
        Overrides:
        characters in class DefaultHandler
        Throws:
        SAXException
      • endElement

        public void endElement​(String uri,
                               String localName,
                               String qName)
                        throws SAXException
        Specified by:
        endElement in interface ContentHandler
        Overrides:
        endElement in class DefaultHandler
        Throws:
        SAXException
      • endElementInternal

        protected void endElementInternal​(ElementHandler handler)
      • endPrefixMapping

        public void endPrefixMapping​(String prefix)
                              throws SAXException
        Specified by:
        endPrefixMapping in interface ContentHandler
        Overrides:
        endPrefixMapping in class DefaultHandler
        Throws:
        SAXException
      • endDocument

        public void endDocument()
                         throws SAXException
        Specified by:
        endDocument in interface ContentHandler
        Overrides:
        endDocument in class DefaultHandler
        Throws:
        SAXException
      • warning

        public void warning​(SAXParseException e)
                     throws SAXException
        Specified by:
        warning in interface ErrorHandler
        Overrides:
        warning in class DefaultHandler
        Throws:
        SAXException
      • error

        public void error​(SAXParseException e)
                   throws SAXException
        Specified by:
        error in interface ErrorHandler
        Overrides:
        error in class DefaultHandler
        Throws:
        SAXException
      • getValue

        public Object getValue()
      • findSchemaLocators

        protected XSDSchemaLocator[] findSchemaLocators()
      • findSchemaLocationResolvers

        protected XSDSchemaLocationResolver[] findSchemaLocationResolvers()
      • startCDATA

        public void startCDATA()
                        throws SAXException
        Specified by:
        startCDATA in interface LexicalHandler
        Overrides:
        startCDATA in class DefaultHandler2
        Throws:
        SAXException
      • endCDATA

        public void endCDATA()
                      throws SAXException
        Specified by:
        endCDATA in interface LexicalHandler
        Overrides:
        endCDATA in class DefaultHandler2
        Throws:
        SAXException
      • isCDATAEnding

        public boolean isCDATAEnding()
        Returns:
        the cDATAEnding
      • setCDATA

        public void setCDATA​(boolean b)
        Inform the parser that it is inside a CDATA block.
      • isCDATA

        public boolean isCDATA()
        Check if the current text is inside a CDATA block.