|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ucl.xpath.function.Function org.ucl.xpath.function.FnEscapeUri
Function to apply URI escaping rules.
Usage: fn:escape-uri($uri-part as xs:string?, $escape-reserved as xs:boolean) as xs:string
This class applies the URI escaping rules (with one exception), to the string supplied as $uri-part, which typically represents all or part of a URI. The effect of the function is to escape a set of identified characters in the string. Each such character is replaced in the string by an escape sequence, which is formed by encoding the character as a sequence of octets in UTF-8, and then representing each of these octets in the form %HH, where HH is the hexadecimal representation of the octet.
The set of characters that are escaped depends on the setting of the boolean argument $escape-reserved.
If $uri-part is the empty sequence, returns the zero-length string.
If $escape-reserved is true, all characters are escaped other than the lower case letters a-z, the upper case letters A-Z, the digits 0-9, the PERCENT SIGN "%" and the NUMBER SIGN "#", as well as certain other characters: specifically, HYPHEN-MINUS ("-"), LOW LINE ("_"), FULL STOP ".", EXCLAMATION MARK "!", TILDE "~", ASTERISK "*", APOSTROPHE "'", LEFT PARENTHESIS "(", and RIGHT PARENTHESIS ")".
If $escape-reserved is false, additional characters are added to the list of characters that are not escaped. These are the following: SEMICOLON ";", SOLIDUS "/", QUESTION MARK "?", COLON ":", COMMERCIAL AT "@", AMPERSAND "&", EQUALS SIGN "=", PLUS SIGN "+", DOLLAR SIGN "$", COMMA ",", LEFT SQUARE BRACKET "[" and RIGHT SQUARE BRACKET "]".
To ensure that escaped URIs can be compared using string comparison functions, this function must always generate hexadecimal values using the upper-case letters A-F.
Generally, $escape-reserved should be set to true when escaping a string that is to form a single part of a URI, and to false when escaping an entire URI or URI reference.
Since this function does not escape the PERCENT SIGN "%" and this character is not allowed in a URI, users wishing to convert character strings, such as file names, that include "%" to a URI should manually escape "%" by replacing it with "%25".
Field Summary |
Fields inherited from class org.ucl.xpath.function.Function |
_arity, _fl, _name |
Constructor Summary | |
FnEscapeUri()
Constructor for FnEscapeUri. |
Method Summary | |
static ResultSequence |
escape_uri(java.util.Collection args)
Apply the URI escaping rules to the arguments. |
ResultSequence |
evaluate(java.util.Collection args)
Evaluate the arguments. |
static java.util.Collection |
expected_args()
Calculate the expected arguments. |
Methods inherited from class org.ucl.xpath.function.Function |
arity, convert_argument, convert_arguments, dynamic_context, name, set_function_library, signature, signature, signature, static_context |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FnEscapeUri()
Method Detail |
public ResultSequence evaluate(java.util.Collection args) throws DynamicError
evaluate
in class Function
args
- are evaluated.
DynamicError
- Dynamic error.public static ResultSequence escape_uri(java.util.Collection args) throws DynamicError
args
- have the URI escaping rules applied to them.
DynamicError
- Dynamic error.public static java.util.Collection expected_args()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |