Class AbstractHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.StringBuffer buf
      Deprecated.
      use getText() to acquire String of internal buffer
      protected int depth
      The element depth count.
      protected SAXSupport parser
      A reference to the SAX parser to which the handler is attached
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractHandler()
      Default constructor.
      protected AbstractHandler​(SAXSupport pParser)
      Initializes the handler and attaches it to the parser.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] ch, int start, int length)  
      void clearText()  
      protected abstract void doEndElement​(java.lang.String uri, java.lang.String local, java.lang.String qName)
      Override this method insted of endElement to process end element event.
      protected void doStartElement​(java.lang.String uri, java.lang.String local, java.lang.String qName, AttributesXt attrsXt)  
      protected void doStartElement​(java.lang.String uri, java.lang.String local, java.lang.String qName, org.xml.sax.Attributes attrs)
      Override this method insted of startElement to process start element event.
      void endDocument()
      This is a safegurd against forgetting to pop out inner handlers.
      void endElement​(java.lang.String uri, java.lang.String local, java.lang.String qName)
      The default implementation that calls doEndElement then reduces the depth count.
      float getFloatValue()  
      int getIntValue()  
      java.lang.String getText()  
      protected void popContentHandler​(java.lang.String uri, java.lang.String local, java.lang.String qName)  
      protected void setLogErrors​(boolean value)  
      void startElement​(java.lang.String uri, java.lang.String local, java.lang.String qName, org.xml.sax.Attributes attrs)
      The default implementation that simply increases the depth count.
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • buf

        protected java.lang.StringBuffer buf
        Deprecated.
        use getText() to acquire String of internal buffer
        A buffer to accumulate element text.
        Since:
        MicroStrategy Web 8.0.0
      • depth

        protected int depth
        The element depth count. It is relative to the handler's root element, an element at which this handler was attached to the parser. Whenever a handler receives the startElement event it increases this counter. Whenever the handler receives the endElement event it decreases the counter. When the counter becomes zero the handler pops itself from the handler stack. Real handler shall use this variable to optimize content handlers. They shall first check the depth and then check for tag names that are expected at this depth.
      • parser

        protected SAXSupport parser
        A reference to the SAX parser to which the handler is attached
    • Constructor Detail

      • AbstractHandler

        protected AbstractHandler()
        Default constructor.
      • AbstractHandler

        protected AbstractHandler​(SAXSupport pParser)
        Initializes the handler and attaches it to the parser.
        Parameters:
        pParser - - a SAX parser to which this handler needs to be attached
    • Method Detail

      • setLogErrors

        protected void setLogErrors​(boolean value)
        Since:
        MicroStrategy Web 8.0.0
      • startElement

        public void startElement​(java.lang.String uri,
                                 java.lang.String local,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes attrs)
                          throws org.xml.sax.SAXException
        The default implementation that simply increases the depth count. and then calls doStartElement method. Override the doStartElement method insted of this one to process start element event. This way you will not have problems with depth counter while subclassing your event handlers.

        When overriding this method you shall either call supper or simply start your code with depth++; statement (which is faster).

        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
        local - The local name (without prefix), or the empty string if Namespace processing is not being performed.
        qName - The qualified name (with prefix), or the empty string if qualified names are not available.
        attrs - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object
        Throws:
        org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception
      • doStartElement

        protected void doStartElement​(java.lang.String uri,
                                      java.lang.String local,
                                      java.lang.String qName,
                                      AttributesXt attrsXt)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
        Since:
        MicroStrategy Web 8.0.0
      • doStartElement

        protected void doStartElement​(java.lang.String uri,
                                      java.lang.String local,
                                      java.lang.String qName,
                                      org.xml.sax.Attributes attrs)
                               throws java.lang.Exception
        Override this method insted of startElement to process start element event. This way you will not have problems with depth counter while subclassing your event handlers.
        Throws:
        org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception
        java.lang.Exception
      • endElement

        public void endElement​(java.lang.String uri,
                               java.lang.String local,
                               java.lang.String qName)
                        throws org.xml.sax.SAXException
        The default implementation that calls doEndElement then reduces the depth count. If this is an event for the handler's root element (depth count goes to zero), then the handlers is detached from (popped out of) the parser.

        Override the doEndElement method insted of this one to process end element event. This way you will not have problems with depth counter while subclassing your event handlers.

        When overriding this method always call super at the end of your code.

        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
        local - The local name (without prefix), or the empty string if Namespace processing is not being performed.
        qName - The qualified name (with prefix), or the empty string if qualified names are not available.
        Throws:
        org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception
      • popContentHandler

        protected void popContentHandler​(java.lang.String uri,
                                         java.lang.String local,
                                         java.lang.String qName)
                                  throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
        Since:
        MicroStrategy Web 8.0.0
      • doEndElement

        protected abstract void doEndElement​(java.lang.String uri,
                                             java.lang.String local,
                                             java.lang.String qName)
                                      throws java.lang.Exception
        Override this method insted of endElement to process end element event. This way you will not have problems with depth counter while subclassing your event handlers.
        Throws:
        org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception
        java.lang.Exception
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws org.xml.sax.SAXException
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        ch - The characters.
        start - The start position in the character array.
        length - The number of characters to use from the character array.
        Throws:
        org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        ContentHandler.characters(char[], int, int)
      • endDocument

        public void endDocument()
                         throws org.xml.sax.SAXException
        This is a safegurd against forgetting to pop out inner handlers. It throws an exception when end document event happens for inner handlers.
        Specified by:
        endDocument in interface org.xml.sax.ContentHandler
        Overrides:
        endDocument in class org.xml.sax.helpers.DefaultHandler
        Throws:
        java.lang.IllegalStateException - when called for inner handler
        org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        ContentHandler.endDocument()
      • getIntValue

        public int getIntValue()
        Since:
        MicroStrategy Web 9.0.0
      • getFloatValue

        public float getFloatValue()
      • getText

        public java.lang.String getText()
        Since:
        MicroStrategy Web 9.0.0
      • clearText

        public void clearText()
        Since:
        MicroStrategy Web 9.0.0