KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xml > utils > PrefixResolver


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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   /**
32    * Given a namespace, get the corrisponding prefix. This assumes that
33    * the PrefixResolver holds its own namespace context, or is a namespace
34    * context itself.
35    *
36    * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace.
37    *
38    * @return The associated Namespace URI, or null if the prefix
39    * is undeclared in this context.
40    */

41   String JavaDoc getNamespaceForPrefix(String JavaDoc prefix);
42
43   /**
44    * Given a namespace, get the corresponding prefix, based on the context node.
45    *
46    * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace.
47    * @param context The node context from which to look up the URI.
48    *
49    * @return The associated Namespace URI as a string, or null if the prefix
50    * is undeclared in this context.
51    */

52   String JavaDoc getNamespaceForPrefix(String JavaDoc prefix, org.w3c.dom.Node JavaDoc context);
53
54   /**
55    * Return the base identifier.
56    *
57    * @return The base identifier from where relative URIs should be absolutized, or null
58    * if the base ID is unknown.
59    * <p>
60    * CAVEAT: Note that the base URI in an XML document may vary with where
61    * you are in the document, if part of the doc's contents were brought in
62    * via an external entity reference or if mechanisms such as xml:base have
63    * been used. Unless this PrefixResolver is bound to a specific portion of
64    * the document, or has been kept up to date via some other mechanism, it
65    * may not accurately reflect that context information.
66    */

67   public String JavaDoc getBaseIdentifier();
68   
69   public boolean handlesNullPrefixes();
70 }
71
Popular Tags