Class ForeignElementFilter

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

    public class ForeignElementFilter
    extends org.xml.sax.helpers.XMLFilterImpl
    Filters out those elements which do not belong to neither RELAX NG or RelaxNGCC.

    We need to have this filter between XMLReader and our parser because our parser is not built to accept foreign elements.

    Author:
    Kohsuke Kawaguchi (kk@kohsuke.org)
    • Constructor Summary

      Constructors 
      Constructor Description
      ForeignElementFilter​(org.xml.sax.XMLReader parent)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] buf, int start, int len)  
      void endElement​(java.lang.String uri, java.lang.String localName, java.lang.String qname)  
      void ignorableWhitespace​(char[] buf, int start, int len)  
      void startElement​(java.lang.String uri, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes atts)  
      • Methods inherited from class org.xml.sax.helpers.XMLFilterImpl

        endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ForeignElementFilter

        public ForeignElementFilter​(org.xml.sax.XMLReader parent)
    • Method Detail

      • startElement

        public void startElement​(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qname,
                                 org.xml.sax.Attributes atts)
                          throws org.xml.sax.SAXException
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.XMLFilterImpl
        Throws:
        org.xml.sax.SAXException
      • endElement

        public void endElement​(java.lang.String uri,
                               java.lang.String localName,
                               java.lang.String qname)
                        throws org.xml.sax.SAXException
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.XMLFilterImpl
        Throws:
        org.xml.sax.SAXException
      • characters

        public void characters​(char[] buf,
                               int start,
                               int len)
                        throws org.xml.sax.SAXException
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.XMLFilterImpl
        Throws:
        org.xml.sax.SAXException
      • ignorableWhitespace

        public void ignorableWhitespace​(char[] buf,
                                        int start,
                                        int len)
                                 throws org.xml.sax.SAXException
        Specified by:
        ignorableWhitespace in interface org.xml.sax.ContentHandler
        Overrides:
        ignorableWhitespace in class org.xml.sax.helpers.XMLFilterImpl
        Throws:
        org.xml.sax.SAXException