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
-
-
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 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 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
-
-
-
-
Constructor Detail
-
HTMLURIEscaper
public HTMLURIEscaper(Receiver nextReceiver)
-
-
Method Detail
-
startDocument
public void startDocument(int properties) throws XPathException
Start of a document node.- Specified by:
startDocument
in interfaceReceiver
- Overrides:
startDocument
in classProxyReceiver
- 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 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 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 escapednormalize
-- Returns:
- the URI after escaping non-ASCII characters
- Throws:
XPathException
-
-