KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > expr > StaticContext


1 package net.sf.saxon.expr;
2 import net.sf.saxon.Configuration;
3 import net.sf.saxon.type.AtomicType;
4 import net.sf.saxon.functions.FunctionLibrary;
5 import net.sf.saxon.instruct.LocationMap;
6 import net.sf.saxon.om.NamePool;
7 import net.sf.saxon.om.NamespaceResolver;
8 import net.sf.saxon.trans.StaticError;
9 import net.sf.saxon.trans.XPathException;
10
11 import javax.xml.transform.SourceLocator JavaDoc;
12 import java.util.Comparator JavaDoc;
13
14 /**
15 * A StaticContext contains the information needed while an expression or pattern
16 * is being parsed. The information is also sometimes needed at run-time.
17 */

18
19 public interface StaticContext {
20
21     /**
22      * Get the system configuration
23      */

24
25     public Configuration getConfiguration();
26
27     /**
28      * Get the location map. This is a mapping from short location ids held with each expression or
29      * subexpression, to a fully-resolved location in a source stylesheet or query.
30      */

31
32     public LocationMap getLocationMap();
33
34     /**
35     * Issue a compile-time warning
36     */

37
38     public void issueWarning(String JavaDoc s, SourceLocator JavaDoc locator);
39
40     /**
41     * Get the System ID of the container of the expression. This is the containing
42     * entity (file) and is therefore useful for diagnostics. Use getBaseURI() to get
43     * the base URI, which may be different.
44     */

45
46     public String JavaDoc getSystemId();
47
48     /**
49     * Get the line number of the expression within its containing entity
50     * Returns -1 if no line number is available
51     */

52
53     public int getLineNumber();
54
55     /**
56     * Get the Base URI of the stylesheet element, for resolving any relative URI's used
57     * in the expression.
58     * Used by the document(), doc(), resolve-uri(), and base-uri() functions.
59     * May return null if the base URI is not known.
60     */

61
62     public String JavaDoc getBaseURI();
63
64     /**
65     * Get the URI for a namespace prefix. The default namespace is NOT used
66     * when the prefix is empty.
67     * @param prefix The prefix
68     * @throws XPathException if the prefix is not declared
69     */

70
71     public String JavaDoc getURIForPrefix(String JavaDoc prefix) throws XPathException;
72
73     /**
74     * Get the NamePool used for compiling expressions
75     */

76
77     public NamePool getNamePool();
78
79     /**
80     * Bind a variable used in this element to the XSLVariable element in which it is declared
81     */

82
83     public VariableDeclaration bindVariable(int fingerprint) throws StaticError;
84
85     /**
86      * Get the function library containing all the in-scope functions available in this static
87      * context
88      */

89
90     public FunctionLibrary getFunctionLibrary();
91
92     /**
93     * Get a named collation.
94     * @param name The name of the required collation. Supply null to get the default collation.
95     * @return the collation; or null if the required collation is not found.
96     */

97
98     public Comparator JavaDoc getCollation(String JavaDoc name) throws XPathException;
99
100     /**
101     * Get the name of the default collation.
102     * @return the name of the default collation; or the name of the codepoint collation
103     * if no default collation has been defined
104     */

105
106     public String JavaDoc getDefaultCollationName();
107
108     /**
109     * Get the default XPath namespace, as a namespace code that can be looked up in the NamePool
110     */

111
112     public short getDefaultElementNamespace();
113
114     /**
115      * Get the default function namespace
116      */

117
118     public String JavaDoc getDefaultFunctionNamespace();
119
120     /**
121     * Determine whether Backwards Compatible Mode is used
122     */

123
124     public boolean isInBackwardsCompatibleMode();
125
126     /**
127      * Determine whether a Schema for a given target namespace has been imported. Note that the
128      * in-scope element declarations, attribute declarations and schema types are the types registered
129      * with the (schema-aware) configuration, provided that their namespace URI is registered
130      * in the static context as being an imported schema namespace. (A consequence of this is that
131      * within a Configuration, there can only be one schema for any given namespace, including the
132      * null namespace).
133      */

134
135     public boolean isImportedSchema(String JavaDoc namespace);
136
137     /**
138      * Determine whether a built-in type is available in this context. This method caters for differences
139      * between host languages as to which set of types are built in.
140      * @param type the supposedly built-in type. This will always be a type in the
141      * XS or XDT namespace.
142      * @return true if this type can be used in this static context
143      */

144
145     public boolean isAllowedBuiltInType(AtomicType type);
146
147     /**
148      * Get a namespace resolver to resolve the namespaces declared in this static context.
149      * @return a namespace resolver.
150      */

151
152     NamespaceResolver getNamespaceResolver();
153
154 }
155
156 //
157
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
158
// you may not use this file except in compliance with the License. You may obtain a copy of the
159
// License at http://www.mozilla.org/MPL/
160
//
161
// Software distributed under the License is distributed on an "AS IS" basis,
162
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
163
// See the License for the specific language governing rights and limitations under the License.
164
//
165
// The Original Code is: all this file.
166
//
167
// The Initial Developer of the Original Code is Michael H. Kay.
168
//
169
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
170
//
171
// Contributor(s): none.
172
//
173
Popular Tags