root/src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/util/resolver/JOMDocURIResolver.java

Revision 1853, 2.9 KB (checked in by dmisev, 2 years ago)

#658 and #634

Line 
1/*
2 * JOMDoc - A Java library for OMDoc documents (http://omdoc.org/jomdoc).
3 *
4 * Original author    Dimitar Misev <d.misev@jacobs-university.de>
5 * Web                http://kwarc.info/dmisev/
6 * Created            Feb 4, 2010, 10:40:40 AM
7 *
8 * Filename           $Id$
9 * Revision           $Revision$
10 * Last modified on   $Date$
11 *               by   $Author$
12 *
13 * Copyright (C) 2007,2008 the KWARC group (http://kwarc.info)
14 * Licensed under the GNU Public License v3 (GPL3).
15 * For other licensing contact Michael Kohlhase <m.kohlhase@jacobs-university.de>
16 */
17package org.omdoc.jomdoc.util.resolver;
18
19import java.io.InputStream;
20import java.net.URI;
21import javax.xml.transform.URIResolver;
22import nu.xom.Document;
23import nu.xom.Element;
24import org.omdoc.jomdoc.lang.OMDocDocument;
25import org.omdoc.jomdoc.lang.OMDocElement;
26import org.omdoc.jomdoc.util.types.Pair;
27import org.w3c.dom.ls.LSResourceResolver;
28
29/**
30 * Throughout JOMDoc this interface is used to resolve URIs.
31 * <p>
32 * {@link LSResourceResolver} is used in RelaxNG schema validation of OMDoc
33 * Documents, while {@link URIResolver} is used in the XSLT transformation.
34 *
35 * @author <a href="mailto:d.misev@jacobs-university.de">Dimitar Misev</a>
36 */
37public interface JOMDocURIResolver extends URIResolver, LSResourceResolver {
38
39    /**
40     * @return a pair (A, B) where A is InputStream to location <code>href</code>
41     * with respect to <code>base</code>, and B is the absolute URI to A.
42     */
43    Pair<? extends InputStream, URI> resolveInputStream(String href, String base) throws ResolveException;
44
45    /**
46     * @return the content at location <code>href</code> with respect to <code>base</code>
47     * as XOM Document.
48     */
49    Document resolveDocument(String href, String base) throws ResolveException;
50
51    /**
52     * @return the content at location <code>href</code> with respect to <code>base</code>
53     * as XOM Element.
54     */
55    Element resolveElement(String href, String base) throws ResolveException;
56
57    /**
58     * @return the content at location <code>href</code> with respect to <code>base</code>
59     * as OMDocDocument.
60     */
61    OMDocDocument resolveOMDocDocument(String href, String base) throws ResolveException;
62
63    /**
64     * @return the content at location <code>href</code> with respect to <code>base</code>
65     * as OMDocElement.
66     */
67    OMDocElement resolveOMDocElement(String href, String base) throws ResolveException;
68
69    /**
70     * @return true if the the schema in the given <code>uri</code> is supported
71     * by this resolver, false if it's not or the uri doesn't have a schema part.
72     */
73    boolean isSchemaSupported(String uri);
74
75    /**
76     * @return true if the the schema in the given <code>uri</code> is supported
77     * by this resolver, false if it's not or the uri doesn't have a schema part.
78     */
79    boolean isSchemaSupported(String href, String base, boolean log);
80}
Note: See TracBrowser for help on using the browser.