Class SaxRule

  • Direct Known Subclasses:

    public class SaxRule
    extends org.apache.commons.digester.Rule
    This class is used as a rule for included documents during Digester parsing. Whenever this element matches in Digester, begin/end will be called, that then puts all further SAX events to the specified SAX ContentHandler.
    Uwe Schindler
    • Constructor Detail

      • SaxRule

        public SaxRule()
        Default constructor
    • Method Detail

      • emptyRule

        public static SaxRule emptyRule()
        Creates an empty "useless" SaxRule. The pupose is to not throw an exception on known but ignored elements (optional with contents).
        an instance that does nothing by feeding all SAX events to an SAX DefaultHandler
      • setDigester

        public void setDigester​(org.apache.commons.digester.Digester digester)
        Set the Digester with which this Rule is associated.
        setDigester in class org.apache.commons.digester.Rule
        IllegalArgumentException - if digester is not an ExtendedDigester instance.
      • setContentHandler

        public void setContentHandler​(ContentHandler ch)
        Sets the SAX ContentHandler that gets all SAX Events after the startElement event.
      • getContentHandler

        public ContentHandler getContentHandler()
        return the current ContentHandler.
      • setExcludeNamespaces

        public void setExcludeNamespaces​(Set<String> excludeNamespaces)
        Sets a Set<String> containing all Namespace URIs that should not be feed to the target ContentHandler on match. Default (or setting to null) means no restriction: All namespace prefixes visible in the current context will be reported.
      • initDocument

        protected void initDocument()
                             throws SAXException
        Add some elements when document started. The default implementation does nothing. This method should be overwritten to feed some additional elements after the startDocument SAX event.
      • finishDocument

        protected void finishDocument()
                               throws SAXException
        Closes the elements created in initDocument(). The default implementation does nothing. This method should be overwritten to feed some ending elements before the endDocument SAX event.
      • end

        public void end​(String namespace,
                        String name)
                 throws Exception
        end in class org.apache.commons.digester.Rule