http://www.zorba-xquery.com/modules/uri ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace uri = "http://www.zorba-xquery.com/modules/uri";

This module provides functions for processing URIs and URLs.

Author:

Matthias Brantner, Luis Rodriguez Gonzalez

XQuery version and encoding for this module:

xquery version "3.0" encoding "utf-8";

Zorba version for this module:

The latest version of this module is 1.0. For more information about module versioning in Zorba please check out this resource.

Module Resources
Namespaces
uri http://www.zorba-xquery.com/modules/uri
ver http://www.zorba-xquery.com/options/versioning
zerr http://www.zorba-xquery.com/errors
Variables
$uri:AUTHORITY as xs:string
Constant for the "authority" part of a URI object.
$uri:FRAGMENT as xs:string
Constant for the "fragment" part of a URI object.
$uri:HOST as xs:string
Constant for the "host" part of a URI object.
$uri:OPAQUE-PART as xs:string
Constant for the "opaque-part" part of a URI object. If this is set in a URI object, then none of $uri:PATH, $uri:HOST, $uri:PORT, $uri:USER-INFO, or : $uri:QUERY may be specified. If this is set in a URI object, $uri:SCHEME must also be specified (ie, it must be an absolute URI).
$uri:PATH as xs:string
Constant for the "path" part of a URI object.
$uri:PORT as xs:string
Constant for the "port" part of a URI object.
$uri:QUERY as xs:string
Constant for the "query" part of a URI object.
$uri:SCHEME as xs:string
Constant for the "scheme" part of a URI object.
$uri:USER-INFO as xs:string
Constant for the "user-info" part of a URI object.
Function Summary
decode ( $u as xs:string ) as xs:string
Percent-decodes (aka URL decoding) the given string.
decode ( $u as xs:string, $decode-plus as xs:boolean ) as xs:string
Percent-decodes (aka URL decoding) the given string.
External decode ( $s as xs:string, $decode-plus as xs:boolean, $charset as xs:string ) as xs:string
Percent-decodes (aka URL decoding) the given string.
External parse ( $uri as xs:string ) as object()
Parses the URI passed as string.
External serialize ( $uri as object() ) as xs:string
Serialize the URI passed as object into a string.
Functions
decode back to 'Function Summary'
declare function uri:decode (
            $u as xs:string
) as xs:string

Percent-decodes (aka URL decoding) the given string. All percent encoded octets will be translated into their decoded UTF-8 representation. Please note that the percent encoding guarantees that a string consists of ASCII characters only. Passing a string that contains non-ASCII characters results in undefined behavior.

Parameters:
Returns:

decode back to 'Function Summary'
declare function uri:decode (
            $u as xs:string,
            $decode-plus as xs:boolean
) as xs:string

Percent-decodes (aka URL decoding) the given string. All percent encoded octets will be translated into their decoded UTF-8 representation. If $decode-plus is specified all occurrences of the char '+' will be replaced with a space ' ' before the percent decoding happens. Please note that the percent encoding guarantees that a string consists of ASCII characters only. Passing a string that contains non-ASCII characters results in undefined behavior.

Parameters:
Returns:

External decode back to 'Function Summary'
declare function uri:decode (
            $s as xs:string,
            $decode-plus as xs:boolean,
            $charset as xs:string
) as xs:string

Percent-decodes (aka URL decoding) the given string. All percent encoded octets will be translated into their decoded UTF-8 representation. If $decode-plus is specified all occurrences of the char '+' will be replaced with a space ' ' before the percent decoding happens. The $charset parameter specifies the source charset after precent decoding. It is used to convert the decoded string into UTF-8. Please note that the percent encoding guarantees that a string consists of ASCII characters only. Passing a string that contains non-ASCII characters results in undefined behavior.

Parameters:
Returns:
Errors:

External parse back to 'Function Summary'
declare function uri:parse (
            $uri as xs:string
) as object()

Parses the URI passed as string. The returned object contains only members with field names declared as constants in this module. For example, let my-uri := "http://www.my.project.com/a/b/c?user=john;pass=1234#profile" return uri:parse(my-uri) returns { "squeme" : "http", "host" : "www.my.project.com", "path" : "/a/b/c", "query" : "user=john;pass=123", "fragment" : "profile" }

Parameters:
Returns:
Errors:

External serialize back to 'Function Summary'
declare function uri:serialize (
            $uri as object()
) as xs:string

Serialize the URI passed as object into a string.

Parameters:
Returns:
Errors: