net.sf.saxon.functions

Class ResolveURI

public class ResolveURI extends SystemFunction

This class supports the resolve-uri() functions in XPath 2.0
Field Summary
StringexpressionBaseURI
Method Summary
voidcheckArguments(ExpressionVisitor visitor)
Expressioncopy()
Copy an expression.
static StringescapeSpaces(String s)
Replace spaces by %20
ItemevaluateItem(XPathContext context)
Evaluate the function at run-time
StringgetStaticBaseURI()
Get the static base URI of the expression
static URImakeAbsolute(String relativeURI, String base)
Construct an absolute URI from a relative URI and a base URI.
static StringtryToExpand(String systemId)
If a system ID can't be parsed as a URL, try to expand it as a relative URI using the current directory as the base URI.

Field Detail

expressionBaseURI

String expressionBaseURI

Method Detail

checkArguments

public void checkArguments(ExpressionVisitor visitor)

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

escapeSpaces

public static String escapeSpaces(String s)
Replace spaces by %20

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the function at run-time

getStaticBaseURI

public String getStaticBaseURI()
Get the static base URI of the expression

makeAbsolute

public static URI makeAbsolute(String relativeURI, String base)
Construct an absolute URI from a relative URI and a base URI. The method uses the resolve method of the java.net.URI class, except where the base URI uses the (non-standard) "jar:" scheme, in which case the method used is new URL(baseURL, relativeURL).

Spaces in either URI are converted to %20

If no base URI is available, and the relative URI is not an absolute URI, then the current directory is used as a base URI.

Parameters: relativeURI the relative URI. Null is permitted provided that the base URI is an absolute URI base the base URI. Null is permitted provided that relativeURI is an absolute URI

Returns: the absolutized URI

Throws: java.net.URISyntaxException if either of the strings is not a valid URI or if the resolution fails

tryToExpand

public static String tryToExpand(String systemId)
If a system ID can't be parsed as a URL, try to expand it as a relative URI using the current directory as the base URI.