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
- Direct Known Subclasses:
XHTMLURIEscaper
This class is used as a filter on the serialization pipeline; it performs the function
of escaping URI-valued attributes in HTML
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic String
escapeURL
(String 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 representationboolean
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 elementMethods 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
-
Field Details
-
currentElement
-
escapeURIAttributes
protected boolean escapeURIAttributes -
pool
-
-
Constructor Details
-
HTMLURIEscaper
-
-
Method Details
-
isUrlAttribute
-
startDocument
Start of a document node.- Specified by:
startDocument
in interfaceReceiver
- Overrides:
startDocument
in classProxyReceiver
- Parameters:
properties
- bit-significant integer indicating properties of the document node. The definitions of the bits are in classReceiverOption
- 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 interfaceReceiver
- Overrides:
startElement
in classProxyReceiver
- Parameters:
nameCode
- the name of the element.type
- the type annotation of the element.attributes
- the attributes of this elementnamespaces
- the in-scope namespaces of this element: generally this is all the in-scope namespaces, without relying on inheriting namespaces from parent elementslocation
- an object providing information about the module, line, and column where the node originatedproperties
- bit-significant properties of the element node. If there are no relevant properties, zero is supplied. The definitions of the bits are in classReceiverOption
- Throws:
XPathException
- if an error occurs
-
escapeURL
public static String escapeURL(String 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 escapednormalize
- true if Unicode normalization (to NFC) is requiredconfig
- the configuration- Returns:
- the URI after escaping non-ASCII characters
- Throws:
XPathException
- if any error occurs
-