Class MagicSAXFilter

java.lang.Object
org.cyberneko.html.filters.DefaultFilter
org.owasp.validator.html.scan.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
     
  • Method Summary

    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(String root, String publicId, 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)
     
     
    void
    processingInstruction(String target, org.apache.xerces.xni.XMLString data, org.apache.xerces.xni.Augmentations augs)
     
    void
     
    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 Details

  • Method Details

    • reset

      public void reset(InternalPolicy instance)
    • 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(String root, String publicId, 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(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 List<String> getErrorMessages()