Class Stripper

All Implemented Interfaces:
Result
Direct Known Subclasses:
StylesheetStripper

public class Stripper extends ProxyEmitter
The Stripper class maintains details of which elements need to be stripped. The code is written to act as a SAX filter to do the stripping.
Author:
Michael H. Kay
  • Constructor Details

    • Stripper

      protected Stripper()
      Default constructor for use in subclasses
    • Stripper

      public Stripper(Mode stripperRules)
      create a Stripper and initialise variables
      Parameters:
      stripperRules - : defines which elements have whitespace stripped. If null, all whitespace is preserved.
  • Method Details

    • setPreserveAll

      public void setPreserveAll()
      Specify that all whitespace nodes are to be preserved
    • getPreserveAll

      public boolean getPreserveAll()
      Determine if all whitespace is to be preserved (in this case, no further testing is needed)
    • setStripAll

      public void setStripAll()
      Specify that all whitespace nodes are to be stripped
    • getStripAll

      public boolean getStripAll()
      Determine if all whitespace is to be stripped (in this case, no further testing is needed)
    • setController

      public void setController(Controller controller)
      Set the Controller to be used
    • isSpacePreserving

      public boolean isSpacePreserving(int nameCode)
      Decide whether an element is in the set of white-space preserving element types
      Parameters:
      uri - The namespace URI of the element name
      localname - The local part of the element name
      Returns:
      true if the element is in the set of white-space preserving element types
    • startDocument

      public void startDocument() throws TransformerException
      Callback interface for SAX: not for application use
      Overrides:
      startDocument in class ProxyEmitter
      Throws:
      TransformerException
    • startElement

      public void startElement(int nameCode, Attributes atts, int[] namespaces, int nscount) throws TransformerException
      Callback interface for SAX: not for application use
      Overrides:
      startElement in class ProxyEmitter
      Parameters:
      namespaces - Array of namespace codes identifying the namespace prefix/uri pairs associated with this element
      nscount - Number of significant entries within namespaces array
      Throws:
      TransformerException
    • endElement

      public void endElement(int nameCode) throws TransformerException
      Callback interface for SAX: not for application use
      Overrides:
      endElement in class ProxyEmitter
      Throws:
      TransformerException
    • characters

      public void characters(char[] ch, int start, int length) throws TransformerException
      Callback interface for SAX: not for application use
      Overrides:
      characters in class ProxyEmitter
      Throws:
      TransformerException