Package org.mycore.common.xml
Class MCRURIResolver
java.lang.Object
org.mycore.common.xml.MCRURIResolver
- All Implemented Interfaces:
URIResolver
Reads XML documents from various URI types. This resolver is used to read DTDs, XML Schema files, XSL document()
usages, xsl:include usages and MyCoRe Editor include declarations. DTDs and Schema files are read from the CLASSPATH
of the application when XML is parsed. XML document() calls and xsl:include calls within XSL stylesheets can be read
from URIs of type resource, webapp, file, session, query or mcrobject. MyCoRe editor include declarations can read
XML files from resource, webapp, file, session, http or https, query, or mcrobject URIs.
- Author:
- Frank Lützenkirchen, Thomas Scheffler (yagee)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
provides a URI -- Resolver Mapping One can implement this interface to provide additional URI schemes this MCRURIResolver should handle, too.static interface
-
Method Summary
Modifier and TypeMethodDescriptiongetParameterMap
(String key) Returns the protocol or scheme for the given URI.static jakarta.servlet.ServletContext
static void
init
(jakarta.servlet.ServletContext ctx) Initializes the MCRURIResolver for servlet applications.static MCRURIResolver
instance()
Returns the MCRURIResolver singletonprotected Element
Reads xml from an InputStream and returns the parsed root element.Reads XML from URIs of various type.URI Resolver that resolves XSL document() or xsl:include calls.
-
Method Details
-
instance
Returns the MCRURIResolver singleton -
init
public static void init(jakarta.servlet.ServletContext ctx) Initializes the MCRURIResolver for servlet applications.- Parameters:
ctx
- the servlet context of this web application
-
getParameterMap
-
getServletContext
public static jakarta.servlet.ServletContext getServletContext() -
resolve
URI Resolver that resolves XSL document() or xsl:include calls.- Specified by:
resolve
in interfaceURIResolver
- Throws:
TransformerException
- See Also:
-
resolve
Reads XML from URIs of various type.- Parameters:
uri
- the URI where to read the XML from- Returns:
- the root element of the XML document
-
getScheme
Returns the protocol or scheme for the given URI.- Parameters:
uri
- the URI to parsebase
- if uri is relative, resolve scheme from base parameter- Returns:
- the protocol/scheme part before the ":"
-
parseStream
Reads xml from an InputStream and returns the parsed root element.- Parameters:
in
- the InputStream that contains the XML document- Returns:
- the root element of the parsed input stream
- Throws:
JDOMException
IOException
-