KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > expr > StaticContext


1 package com.icl.saxon.expr;
2 import com.icl.saxon.Binding;
3 import com.icl.saxon.om.NamePool;
4 import com.icl.saxon.pattern.NameTest;
5 import com.icl.saxon.pattern.NamespaceTest;
6 import javax.xml.transform.TransformerException JavaDoc;
7
8
9 /**
10 * A StaticContext contains the information needed while an expression or pattern
11 * is being parsed. The information is also sometimes needed at run-time.
12 */

13
14 public interface StaticContext {
15     
16     /**
17     * Copy the context with a different namepool
18     */

19     
20     public StaticContext makeRuntimeContext(NamePool pool);
21
22     /**
23     * Get the System ID of the container of the expression. This is the containing
24     * entity (file) and is therefore useful for diagnostics. Use getBaseURI() to get
25     * the base URI, which may be different.
26     */

27
28     public String JavaDoc getSystemId();
29
30     /**
31     * Get the line number of the expression within its containing entity
32     * Returns -1 if no line number is available
33     */

34
35     public int getLineNumber();
36     
37     /**
38     * Get the Base URI of the stylesheet element, for resolving any relative URI's used
39     * in the expression.
40     * Used by the document() function.
41     */

42     
43     public String JavaDoc getBaseURI();
44
45     /**
46     * Get the URI for a prefix, using this Element as the context for namespace resolution
47     * @param prefix The prefix
48     * @throw XPathException if the prefix is not declared
49     */

50
51     public String JavaDoc getURIForPrefix(String JavaDoc prefix) throws XPathException;
52
53     /**
54     * Make a NameCode, using this Element as the context for namespace resolution
55     * @param qname The name as written, in the form "[prefix:]localname"
56     * @boolean useDefault Defines the action when there is no prefix. If true, use
57     * the default namespace URI (as for element names). If false, use no namespace URI
58     * (as for attribute names).
59     */

60
61     public int makeNameCode(String JavaDoc qname, boolean useDefault) throws XPathException;
62
63     /**
64     * Get a fingerprint for a name, using this as the context for namespace resolution
65     * @param qname The name as written, in the form "[prefix:]localname"
66     * @boolean useDefault Defines the action when there is no prefix. If true, use
67     * the default namespace URI (as for element names). If false, use no namespace URI
68     * (as for attribute names).
69     * @return -1 if the name is not already present in the name pool
70     */

71
72     public int getFingerprint(String JavaDoc qname, boolean useDefault) throws XPathException;
73
74     /**
75     * Make a NameTest, using this element as the context for namespace resolution
76     */

77     
78     public NameTest makeNameTest(short nodeType, String JavaDoc qname, boolean useDefault)
79         throws XPathException;
80
81     /**
82     * Make a NamespaceTest, using this element as the context for namespace resolution
83     */

84     
85     public NamespaceTest makeNamespaceTest(short nodeType, String JavaDoc prefix)
86             throws XPathException;
87
88     /**
89     * Bind a variable to an object that can be used to refer to it
90     * @param fingerprint The fingerprint of the variable name
91     * @return a Binding object that can be used to identify it in the Bindery
92     * @throws XPathException if the variable has not been declared, or if the context
93     * does not allow the use of variables
94     */

95
96     public Binding bindVariable(int fingerprint) throws XPathException;
97
98     /**
99     * Determine whether a given URI code identifies an extension element namespace
100     */

101
102     public boolean isExtensionNamespace(short uriCode) throws XPathException;
103
104     /**
105     * Determine whether forwards-compatible mode is enabled
106     */

107
108     public boolean forwardsCompatibleModeIsEnabled() throws XPathException;
109
110     /*
111     * Get a Function declared using a saxon:function element in the stylesheet
112     * @param fingerprint the fingerprint of the name of the function
113     * @return the Function object represented by this saxon:function; or null if not found
114     */

115
116     public Function getStyleSheetFunction(int fingerprint) throws XPathException;
117     
118     /**
119     * Get an external Java class corresponding to a given namespace prefix, if there is
120     * one.
121     * @param uri The namespace URI corresponding to the prefix used in the function call.
122     * @return the Java class if a suitable class exists, otherwise return null.
123     * @throws TransformerException if the class is found, but cannot be loaded.
124     */

125     
126     public Class JavaDoc getExternalJavaClass(String JavaDoc uri) throws TransformerException JavaDoc;
127     
128     /**
129     * Determine if an extension element is available
130     */

131     
132     public boolean isElementAvailable(String JavaDoc qname) throws XPathException;
133
134     /**
135     * Determine if a function is available
136     */

137     
138     public boolean isFunctionAvailable(String JavaDoc qname) throws XPathException;
139
140     /**
141     * Determine whether the key() function is permmitted in this context
142     */

143     
144     public boolean allowsKeyFunction();
145
146     /**
147     * Get the effective XSLT version in this region of the stylesheet
148     */

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