Class SelectedElementsSpaceStrippingRule

  • All Implemented Interfaces:

    public class SelectedElementsSpaceStrippingRule
    extends java.lang.Object
    implements SpaceStrippingRule
    A whitespace stripping rule that strips elected elements unless xml:space indicates that whitespace should be preserved.
    • Constructor Detail

      • SelectedElementsSpaceStrippingRule

        public SelectedElementsSpaceStrippingRule​(boolean rejectDuplicates)
        Create the ruleset
        rejectDuplicates - indicates whether duplicate conflicting rules are a static error
    • Method Detail

      • isSpacePreserving

        public int isSpacePreserving​(NodeName fingerprint,
                                     SchemaType schemaType)
                              throws XPathException
        Decide whether an element is in the set of white-space preserving element names
        Specified by:
        isSpacePreserving in interface SpaceStrippingRule
        fingerprint - identifies the name of the element whose whitespace is to be preserved
        schemaType - the type annotation of the element
        ALWAYS_PRESERVE if the element is in the set of white-space preserving element types, ALWAYS_STRIP if the element is to be stripped regardless of the xml:space setting, and STRIP_DEFAULT otherwise
        XPathException - if the rules are ambiguous and ambiguities are to be reported as errors
      • addRule

        public void addRule​(NodeTest test,
                            Stripper.StripRuleTarget action,
                            StylesheetModule module,
                            int lineNumber)
                     throws XPathException
        Add a rule
        test - a NodeTest (*, *:local, prefix:*, or QName)
        action - StripRuleTarget.STRIP or StripRuleTarget.PRESERVE
        module - the stylesheet module containing the rule
        lineNumber - the line where the strip-space or preserve-space instruction appears
        XPathException - if this rule is a conflicting duplicate
      • getRule

        public Rule getRule​(NodeName nodeName)
        Get the rule corresponding to a given element node, by finding the best pattern match.
        nodeName - the name of the element node to be matched
        the best matching rule, if any (otherwise null).
      • getRankedRules

        public java.util.Iterator<Rule> getRankedRules()
        Get all the rules in rank order, highest-ranking rules first
        the rules in rank order
      • makeStripper

        public ProxyReceiver makeStripper​(Receiver next)
        Make a filter to implement these space-stripping rules, or null if no filtering is necessary
        Specified by:
        makeStripper in interface SpaceStrippingRule
        next - the Receiver that is to receive the filtered event stream
        a filter in the form of a ProxyReceiver, or null