public final class XMLUtil
extends java.lang.Object
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.
This utility class should be used instead of the original
class org.apache.xml.utils.SystemIDResolver
to be independent
of xerces.
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getAbsoluteURI(java.lang.String url)
Take a SystemID string and try and turn it into a good absolute URL.
|
static java.lang.String |
getAbsoluteURI(java.lang.String urlString,
java.lang.String base)
Take a SystemID string and try and turn it into a good absolute URL.
|
static java.lang.String |
getAbsoluteURIFromRelative(java.lang.String uri)
Get absolute URI from a given relative URI.
|
static java.lang.String |
getLocallizedMessageAndLocation(org.xml.sax.SAXParseException e)
Formats the systemId, column and row into to a String.
|
static java.lang.String |
getLocallizedMessageAndLocation(javax.xml.transform.TransformerException e)
Get the localized error message of a TransformerException with location
information appended.
|
public static java.lang.String getAbsoluteURIFromRelative(java.lang.String uri)
The URI is resolved relative to the system property "user.dir" if it is available; if not (i.e. in an Applet perhaps which throws SecurityException) then it is currently resolved relative to "" or a blank string. Also replaces all backslashes with forward slashes.
uri
- Relative URI to resolvepublic static java.lang.String getAbsoluteURI(java.lang.String url)
url
- A URL string, which may be relative or absolute.public static java.lang.String getAbsoluteURI(java.lang.String urlString, java.lang.String base) throws javax.xml.transform.TransformerException
urlString
- SystemID stringbase
- Base URI to use to resolve the given systemIDjavax.xml.transform.TransformerException
- thrown if the string can't be turned into a URL.public static java.lang.String getLocallizedMessageAndLocation(javax.xml.transform.TransformerException e)
e
- the exceptionString
representing the error message with
location information appended.public static java.lang.String getLocallizedMessageAndLocation(org.xml.sax.SAXParseException e)
e
- the exceptionSubmit a
bug or a
feature.
Created by
xsddoc, a sub project of
xframe, hosted at
http://www.sourceforge.net.