Package net.sf.saxon.serialize

## Class HTMLURIEscaper

- java.lang.Object
- - net.sf.saxon.event.SequenceReceiver
  - - net.sf.saxon.event.ProxyReceiver
    - - net.sf.saxon.serialize.HTMLURIEscaper

- All Implemented Interfaces:
    `javax.xml.transform.Result`, `Receiver`
  Direct Known Subclasses:
    `XHTMLURIEscaper`

      public class HTMLURIEscaper
      extends ProxyReceiver

  This class is used as a filter on the serialization pipeline; it performs the function of escaping URI-valued attributes in HTML

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected NodeName` | `currentElement` |
    `protected boolean` | `escapeURIAttributes` |
    `protected NamePool` | `pool` |

    - ### Fields inherited from class net.sf.saxon.event.ProxyReceiver

      `nextReceiver`

    - ### Fields inherited from class net.sf.saxon.event.SequenceReceiver

      `pipelineConfiguration, previousAtomic, systemId`

    - ### Fields inherited from interface javax.xml.transform.Result

      `PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HTMLURIEscaper​(Receiver nextReceiver)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.lang.CharSequence` | `escapeURL​(java.lang.CharSequence url, boolean normalize, Configuration config)` | Escape a URI according to the HTML rules: that is, a non-ASCII character (specifically, a character outside the range 32 - 126) is replaced by the %HH encoding of the octets in its UTF-8 representation
    `boolean` | `isUrlAttribute​(NodeName element, NodeName attribute)` |
    `void` | `startDocument​(int properties)` | Start of a document node.
    `void` | `startElement​(NodeName nameCode, SchemaType type, AttributeMap attributes, NamespaceMap namespaces, Location location, int properties)` | Notify the start of an element

    - ### Methods inherited from class net.sf.saxon.event.ProxyReceiver

      `append, characters, close, comment, endDocument, endElement, getNamePool, getNextReceiver, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, usesTypeAnnotations`

    - ### Methods inherited from class net.sf.saxon.event.SequenceReceiver

      `append, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getPipelineConfiguration, getSystemId, handlesAppend`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### currentElement

          protected NodeName currentElement

    - #### escapeURIAttributes

          protected boolean escapeURIAttributes

    - #### pool

          protected NamePool pool

  - ### Constructor Detail

    - #### HTMLURIEscaper

          public HTMLURIEscaper​(Receiver nextReceiver)

  - ### Method Detail

    - #### isUrlAttribute

          public boolean isUrlAttribute​(NodeName element,
                                        NodeName attribute)

    - #### startDocument

          public void startDocument​(int properties)
                             throws XPathException

      Start of a document node.
      Specified by:
        `startDocument` in interface `Receiver`
      Overrides:
        `startDocument` in class `ProxyReceiver`
      Parameters:
        `properties` -
      Throws:
        `XPathException` - if an error occurs

    - #### startElement

          public void startElement​(NodeName nameCode,
                                   SchemaType type,
                                   AttributeMap attributes,
                                   NamespaceMap namespaces,
                                   Location location,
                                   int properties)
                            throws XPathException

      Notify the start of an element
      Specified by:
        `startElement` in interface `Receiver`
      Overrides:
        `startElement` in class `ProxyReceiver`
      Parameters:
        `nameCode` - the name of the element.
        `type` - the type annotation of the element.
        `attributes` - the attributes of this element
        `namespaces` - the in-scope namespaces of this element: generally this is all the in-scope namespaces, without relying on inheriting namespaces from parent elements
        `location` - an object providing information about the module, line, and column where the node originated
        `properties` - bit-significant properties of the element node. If there are no relevant properties, zero is supplied. The definitions of the bits are in class `ReceiverOption`
      Throws:
        `XPathException` - if an error occurs

    - #### escapeURL

          public static java.lang.CharSequence escapeURL​(java.lang.CharSequence url,
                                                         boolean normalize,
                                                         Configuration config)
                                                  throws XPathException

      Escape a URI according to the HTML rules: that is, a non-ASCII character (specifically, a character outside the range 32 - 126) is replaced by the %HH encoding of the octets in its UTF-8 representation
      Parameters:
        `url` - the URI to be escaped
        `normalize` -
      Returns:
        the URI after escaping non-ASCII characters
      Throws:
        `XPathException`