Parses a URI, returning a map containing information about its components.

analyze-uri($uri as xs:string) ➔ map(xs:string, item()*)





The URI to be analyzed


map(xs:string, item()*)


Notes on the Saxon implementation

Available since Saxon 10.


This function analyzes a supplied URI (supplied in the form of a string) and returns information about its properties. The returned information is in the form of a map whose keys are all strings. Most of the components are optional, and will be absent when not present in the supplied URI.

The precise behaviour is defined by reference to the corresponding properties delivered by the class.

The following entries are available in the returned map, where applicable:

Key Type Value
isValid boolean true if the string represents a valid URI. If the value is false, the only other entry will be error.
error string if the URI is invalid, a description of the error.
isAbsolute boolean true if the URI is absolutet
isOpaque boolean true if the URI is opaque
authority string The authority component of the URI, with escaped characters decoded
rawAuthority string The authority component of the URI, as written
userInfo string
rawUserInfo string
scheme string
host string
schemeSpecificPart string
rawSchemeSpecificPart string
port integer
path string
rawPath string
query string
rawQuery string
queryParams map(xs:string, xs:string*) A map obtained by extracting the parameters in the query part of the URI, treating these as key=value pairs separated by ampersands or semicolons. If there is an equals sign but no value, the value is treated as a zero-length string. If there is no equals sign, the value is treated as an empty sequence. If a parameter appears twice, then the resulting values are combined, in order, and returned as a sequence. If any parameters in the URI were percent-encoded, they will be returned in decoded form.
fragment string
rawFragment string
asciiString string