APIdia Launch Partner
Top Description Constructors Methods
com.sun.org.apache.xml.internal.utils

public Class SystemIDResolver

extends Object
Class Inheritance
Imports
java.io.File, javax.xml.transform.TransformerException, com.sun.org.apache.xml.internal.utils.URI.MalformedURIException

This class is used to resolve relative URIs and SystemID strings into absolute URIs.

This is a generic utility for resolving URIs, other than the fact that it's declared to throw TransformerException. Please see code comments for details on how resolution is performed.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static String

Returns:

The absolute path
getAbsolutePathFromRelativePath
(String
A relative path
relativePath
)

Return an absolute path from a relative path.

public static String

Returns:

The resolved absolute URI
getAbsoluteURI
(String
A URI string, which may be absolute or relative.
systemId
)

Take a SystemID string and try to turn it into a good absolute URI.

public static String

Returns:

The resolved absolute URI
getAbsoluteURI
(String
SystemID string
urlString
,
String
The URI string used as the base for resolving the systemID
base
)

Take a SystemID string and try to turn it into a good absolute URI.

public static String

Returns:

Resolved absolute URI
getAbsoluteURIFromRelative
(String
The relative URI to resolve
localPath
)

Get an absolute URI from a given relative URI (local path).

public static boolean

Returns:

true if the path is absolute
isAbsolutePath
(String
The path string
systemId
)

Return true if the local path is an absolute path.

public static boolean

Returns:

true if the systemId is an an absolute URI
isAbsoluteURI
(String
The systemId string
systemId
)

Return true if the systemId denotes an absolute URI .

private static boolean

Returns:

true if the path is a Windows absolute path
isWindowsAbsolutePath
(String
The path string
systemId
)

Return true if the local path is a Windows absolute path.

private static String

Returns:

The string after conversion
replaceChars
(String
The input string
str
)

Replace spaces with "%20" and backslashes with forward slashes in the input string to generate a well-formed URI string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SystemIDResolverback to summary
public SystemIDResolver()

Method Detail

getAbsolutePathFromRelativePathback to summary
private static String getAbsolutePathFromRelativePath(String relativePath)

Return an absolute path from a relative path.

Parameters
relativePath:String

A relative path

Returns:String

The absolute path

getAbsoluteURIback to summary
public static String getAbsoluteURI(String systemId)

Take a SystemID string and try to turn it into a good absolute URI.

Parameters
systemId:String

A URI string, which may be absolute or relative.

Returns:String

The resolved absolute URI

getAbsoluteURIback to summary
public static String getAbsoluteURI(String urlString, String base) throws TransformerException

Take a SystemID string and try to turn it into a good absolute URI.

Parameters
urlString:String

SystemID string

base:String

The URI string used as the base for resolving the systemID

Returns:String

The resolved absolute URI

Exceptions
TransformerException:
thrown if the string can't be turned into a URI.
getAbsoluteURIFromRelativeback to summary
public static String getAbsoluteURIFromRelative(String localPath)

Get an absolute URI from a given relative URI (local path).

The relative URI is a local filesystem path. The path can be absolute or relative. If it is a relative path, it is resolved relative to the system property "user.dir" if it is available; if not then we just return the relative path. The space and backslash characters are also replaced to generate a good absolute URI.

Parameters
localPath:String

The relative URI to resolve

Returns:String

Resolved absolute URI

isAbsolutePathback to summary
public static boolean isAbsolutePath(String systemId)

Return true if the local path is an absolute path.

Parameters
systemId:String

The path string

Returns:boolean

true if the path is absolute

isAbsoluteURIback to summary
public static boolean isAbsoluteURI(String systemId)

Return true if the systemId denotes an absolute URI .

Parameters
systemId:String

The systemId string

Returns:boolean

true if the systemId is an an absolute URI

isWindowsAbsolutePathback to summary
private static boolean isWindowsAbsolutePath(String systemId)

Return true if the local path is a Windows absolute path.

Parameters
systemId:String

The path string

Returns:boolean

true if the path is a Windows absolute path

replaceCharsback to summary
private static String replaceChars(String str)

Replace spaces with "%20" and backslashes with forward slashes in the input string to generate a well-formed URI string.

Parameters
str:String

The input string

Returns:String

The string after conversion