- All Modules
- All Functions
-
www.w3.org
- 2005
- XDM
- store
- introspection
- reflection
- external
-
xqdoc
-
xqdoc
(E)
-
project_xqdoc
- xqdoc2xhtml
-
xqdoc
(E)
- data processing
- expath.org
- www.functx.com
- Zorba
- debugger
- error
- jsoniq.org
- www.zorba-xquery.com
http://www.zorba-xquery.com/modules/uri
import module namespace uri = "http://www.zorba-xquery.com/modules/uri";
This module provides functions for processing URIs and URLs.
Matthias Brantner, Luis Rodriguez Gonzalez
xquery version "3.0" encoding "utf-8";
The latest version of this module is 1.0. For more information about module versioning in Zorba please check out this resource.
- the XQuery module can be found here.
uri | http://www.zorba-xquery.com/modules/uri |
ver | http://www.zorba-xquery.com/options/versioning |
zerr | http://www.zorba-xquery.com/errors |
$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. |
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. |
|
![]() |
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. |
![]() |
parse
(
$uri as xs:string
) as object() Parses the URI passed as string. |
![]() |
serialize
(
$uri as object()
) as xs:string Serialize the URI passed as object into a string. |
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.
- $s the string to decode
- the percent decoded string
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.
- $s the string to decode
- $decode-plus whether '+' chars will be replaced with spaces
- the percent decoded string
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.
- $s the string to decode
- $decode-plus whether '+' chars will be replaced with spaces
- $charset the source charset of the string after percent decoding
- the percent decoded string
- zerr:ZXQP0006 if the given charset is unknown or not supported
- zerr:ZOSE0006 if there is an error transcoding the string
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" }
- $uri the URI to parse
- the JSON object
- err:XQST0046 if the URI is textually invalid
declare function uri:serialize ( $uri as object() ) as xs:string
Serialize the URI passed as object into a string.
- $uri the object representing the URI
- the URI as string
- zerr:ZURI0001 if opaque part is specified in conjunction with host/port/path/user-info/query.
- zerr:ZURI0002 if opaque part is present but no scheme is present.
- zerr:ZURI0003 if a path component for an absolute URI doesn't start with "/".