Class MagicSAXFilter

  • All Implemented Interfaces:
    org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDocumentFilter, org.apache.xerces.xni.parser.XMLDocumentSource, org.apache.xerces.xni.XMLDocumentHandler, org.cyberneko.html.HTMLComponent

    public class MagicSAXFilter
    extends org.cyberneko.html.filters.DefaultFilter
    implements org.apache.xerces.xni.parser.XMLDocumentFilter
    Implementation of an HTML-filter that adheres to an AntiSamy policy. This filter is SAX-based which means it is much more memory-efficient and also a bit faster than the DOM-based implementation.
    • Field Summary

      • Fields inherited from class org.cyberneko.html.filters.DefaultFilter

        fDocumentHandler, fDocumentSource
    • Constructor Summary

      Constructors 
      Constructor Description
      MagicSAXFilter​(java.util.ResourceBundle messages)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)  
      void comment​(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)  
      void doctypeDecl​(java.lang.String root, java.lang.String publicId, java.lang.String systemId, org.apache.xerces.xni.Augmentations augs)  
      void emptyElement​(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)  
      void endCDATA​(org.apache.xerces.xni.Augmentations augs)  
      void endElement​(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)  
      java.util.List<java.lang.String> getErrorMessages()  
      void processingInstruction​(java.lang.String target, org.apache.xerces.xni.XMLString data, org.apache.xerces.xni.Augmentations augs)  
      void reset​(InternalPolicy instance)  
      void startCDATA​(org.apache.xerces.xni.Augmentations augs)  
      void startElement​(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)  
      • Methods inherited from class org.cyberneko.html.filters.DefaultFilter

        endDocument, endGeneralEntity, endPrefixMapping, getDocumentHandler, getDocumentSource, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, ignorableWhitespace, merge, reset, setDocumentHandler, setDocumentSource, setFeature, setProperty, startDocument, startDocument, startGeneralEntity, startPrefixMapping, textDecl, xmlDecl
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.xerces.xni.XMLDocumentHandler

        endDocument, endGeneralEntity, getDocumentSource, ignorableWhitespace, setDocumentSource, startDocument, startGeneralEntity, textDecl, xmlDecl
      • Methods inherited from interface org.apache.xerces.xni.parser.XMLDocumentSource

        getDocumentHandler, setDocumentHandler
    • Constructor Detail

      • MagicSAXFilter

        public MagicSAXFilter​(java.util.ResourceBundle messages)
    • Method Detail

      • characters

        public void characters​(org.apache.xerces.xni.XMLString text,
                               org.apache.xerces.xni.Augmentations augs)
                        throws org.apache.xerces.xni.XNIException
        Specified by:
        characters in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        characters in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • comment

        public void comment​(org.apache.xerces.xni.XMLString text,
                            org.apache.xerces.xni.Augmentations augs)
                     throws org.apache.xerces.xni.XNIException
        Specified by:
        comment in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        comment in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • doctypeDecl

        public void doctypeDecl​(java.lang.String root,
                                java.lang.String publicId,
                                java.lang.String systemId,
                                org.apache.xerces.xni.Augmentations augs)
                         throws org.apache.xerces.xni.XNIException
        Specified by:
        doctypeDecl in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        doctypeDecl in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • emptyElement

        public void emptyElement​(org.apache.xerces.xni.QName element,
                                 org.apache.xerces.xni.XMLAttributes attributes,
                                 org.apache.xerces.xni.Augmentations augs)
                          throws org.apache.xerces.xni.XNIException
        Specified by:
        emptyElement in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        emptyElement in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • endElement

        public void endElement​(org.apache.xerces.xni.QName element,
                               org.apache.xerces.xni.Augmentations augs)
                        throws org.apache.xerces.xni.XNIException
        Specified by:
        endElement in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        endElement in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • processingInstruction

        public void processingInstruction​(java.lang.String target,
                                          org.apache.xerces.xni.XMLString data,
                                          org.apache.xerces.xni.Augmentations augs)
                                   throws org.apache.xerces.xni.XNIException
        Specified by:
        processingInstruction in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        processingInstruction in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • startCDATA

        public void startCDATA​(org.apache.xerces.xni.Augmentations augs)
                        throws org.apache.xerces.xni.XNIException
        Specified by:
        startCDATA in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        startCDATA in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • endCDATA

        public void endCDATA​(org.apache.xerces.xni.Augmentations augs)
                      throws org.apache.xerces.xni.XNIException
        Specified by:
        endCDATA in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        endCDATA in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • startElement

        public void startElement​(org.apache.xerces.xni.QName element,
                                 org.apache.xerces.xni.XMLAttributes attributes,
                                 org.apache.xerces.xni.Augmentations augs)
                          throws org.apache.xerces.xni.XNIException
        Specified by:
        startElement in interface org.apache.xerces.xni.XMLDocumentHandler
        Overrides:
        startElement in class org.cyberneko.html.filters.DefaultFilter
        Throws:
        org.apache.xerces.xni.XNIException
      • getErrorMessages

        public java.util.List<java.lang.String> getErrorMessages()