01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: /*
17: * $Id: PrefixResolver.java,v 1.6 2004/02/17 04:21:14 minchau Exp $
18: */
19: package org.apache.xml.utils;
20:
21: /**
22: * The class that implements this interface can resolve prefixes to
23: * namespaces. Examples would include resolving the meaning of a
24: * prefix at a particular point in a document, or mapping the prefixes
25: * used in an XPath expression.
26: * @xsl.usage advanced
27: */
28: public interface PrefixResolver {
29:
30: /**
31: * Given a namespace, get the corrisponding prefix. This assumes that
32: * the PrefixResolver holds its own namespace context, or is a namespace
33: * context itself.
34: *
35: * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace.
36: *
37: * @return The associated Namespace URI, or null if the prefix
38: * is undeclared in this context.
39: */
40: String getNamespaceForPrefix(String prefix);
41:
42: /**
43: * Given a namespace, get the corresponding prefix, based on the context node.
44: *
45: * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace.
46: * @param context The node context from which to look up the URI.
47: *
48: * @return The associated Namespace URI as a string, or null if the prefix
49: * is undeclared in this context.
50: */
51: String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context);
52:
53: /**
54: * Return the base identifier.
55: *
56: * @return The base identifier from where relative URIs should be absolutized, or null
57: * if the base ID is unknown.
58: * <p>
59: * CAVEAT: Note that the base URI in an XML document may vary with where
60: * you are in the document, if part of the doc's contents were brought in
61: * via an external entity reference or if mechanisms such as xml:base have
62: * been used. Unless this PrefixResolver is bound to a specific portion of
63: * the document, or has been kept up to date via some other mechanism, it
64: * may not accurately reflect that context information.
65: */
66: public String getBaseIdentifier();
67:
68: public boolean handlesNullPrefixes();
69: }
|