Source Code Cross Referenced for NamespaceContext.java in  » 6.0-JDK-Core » xml » javax » xml » namespace » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.namespace 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.xml.namespace;
027
028        import java.util.Iterator;
029
030        /**
031         * <p>Interface for read only XML Namespace context processing.</p>
032         *
033         * <p>An XML Namespace has the properties:</p>
034         * <ul>
035         *   <li>Namespace URI:
036         *       Namespace name expressed as a URI to which the prefix is bound</li>
037         *   <li>prefix: syntactically, this is the part of the attribute name
038         *       following the <code>XMLConstants.XMLNS_ATTRIBUTE</code>
039         *       ("xmlns") in the Namespace declaration</li>
040         * </ul>
041         * <p>example:
042         * <code>&lt;element xmlns:prefix="http://Namespace-name-URI"&gt;</code></p>
043         *
044         * <p>All <code>get*(*)</code> methods operate in the current scope
045         * for Namespace URI and prefix resolution.</p>
046         *
047         * <p>Note that a Namespace URI can be bound to
048         * <strong>multiple</strong> prefixes in the current scope.  This can
049         * occur when multiple <code>XMLConstants.XMLNS_ATTRIBUTE</code>
050         * ("xmlns") Namespace declarations occur in the same Start-Tag and
051         * refer to the same Namespace URI. e.g.<br />
052         * <pre>
053         * &lt;element xmlns:prefix1="http://Namespace-name-URI"
054         *          xmlns:prefix2="http://Namespace-name-URI"&gt;
055         * </pre>
056         * This can also occur when the same Namespace URI is used in multiple
057         * <code>XMLConstants.XMLNS_ATTRIBUTE</code> ("xmlns") Namespace
058         * declarations in the logical parent element hierarchy.  e.g.<br />
059         * <pre>
060         * &lt;parent xmlns:prefix1="http://Namespace-name-URI">
061         *   &lt;child xmlns:prefix2="http://Namespace-name-URI"&gt;
062         *     ...
063         *   &lt;/child&gt;
064         * &lt;/parent&gt;
065         * </pre></p>
066         *
067         * <p>A prefix can only be bound to a <strong>single</strong>
068         * Namespace URI in the current scope.</p>
069         *
070         * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
071         * @version $Revision: 1.2 $, $Date: 2005/06/10 03:50:28 $
072         * @see javax.xml.XMLConstants
073         *   javax.xml.XMLConstants for declarations of common XML values
074         * @see <a href="http://www.w3.org/TR/xmlschema-2/#QName">
075         *   XML Schema Part2: Datatypes</a>
076         * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
077         *   Namespaces in XML</a>
078         * @see <a href="http://www.w3.org/XML/xml-names-19990114-errata">
079         *   Namespaces in XML Errata</a>
080         * @since 1.5
081         */
082
083        public interface NamespaceContext {
084
085            /**
086             * <p>Get Namespace URI bound to a prefix in the current scope.</p>
087             *
088             * <p>When requesting a Namespace URI by prefix, the following
089             * table describes the returned Namespace URI value for all
090             * possible prefix values:</p>
091             *
092             * <table border="2" rules="all" cellpadding="4">
093             *   <thead>
094             *     <tr>
095             *       <td align="center" colspan="2">
096             *         <code>getNamespaceURI(prefix)</code>
097             *         return value for specified prefixes
098             *       </td>
099             *     </tr>
100             *     <tr>
101             *       <td>prefix parameter</td>
102             *       <td>Namespace URI return value</td>
103             *     </tr>
104             *   </thead>
105             *   <tbody>
106             *     <tr>
107             *       <td><code>DEFAULT_NS_PREFIX</code> ("")</td>
108             *       <td>default Namespace URI in the current scope or
109             *         <code>{@link
110             *         javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI("")}
111             *         </code>
112             *         when there is no default Namespace URI in the current scope</td>
113             *     </tr>
114             *     <tr>
115             *       <td>bound prefix</td>
116             *       <td>Namespace URI bound to prefix in current scope</td>
117             *     </tr>
118             *     <tr>
119             *       <td>unbound prefix</td>
120             *       <td>
121             *         <code>{@link
122             *         javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI("")}
123             *         </code>
124             *       </td>
125             *     </tr>
126             *     <tr>
127             *       <td><code>XMLConstants.XML_NS_PREFIX</code> ("xml")</td>
128             *       <td><code>XMLConstants.XML_NS_URI</code>
129             *           ("http://www.w3.org/XML/1998/namespace")</td>
130             *     </tr>
131             *     <tr>
132             *       <td><code>XMLConstants.XMLNS_ATTRIBUTE</code> ("xmlns")</td>
133             *       <td><code>XMLConstants.XMLNS_ATTRIBUTE_NS_URI</code>
134             *         ("http://www.w3.org/2000/xmlns/")</td>
135             *     </tr>
136             *     <tr>
137             *       <td><code>null</code></td>
138             *       <td><code>IllegalArgumentException</code> is thrown</td>
139             *     </tr>
140             *    </tbody>
141             * </table>
142             *
143             * @param prefix prefix to look up
144             *
145             * @return Namespace URI bound to prefix in the current scope
146             *
147             * @throws IllegalArgumentException When <code>prefix</code> is
148             *   <code>null</code>
149             */
150            String getNamespaceURI(String prefix);
151
152            /**
153             * <p>Get prefix bound to Namespace URI in the current scope.</p>
154             *
155             * <p>To get all prefixes bound to a Namespace URI in the current
156             * scope, use {@link #getPrefixes(String namespaceURI)}.</p>
157             *
158             * <p>When requesting a prefix by Namespace URI, the following
159             * table describes the returned prefix value for all Namespace URI
160             * values:</p>
161             *
162             * <table border="2" rules="all" cellpadding="4">
163             *   <thead>
164             *     <tr>
165             *       <th align="center" colspan="2">
166             *         <code>getPrefix(namespaceURI)</code> return value for
167             *         specified Namespace URIs
168             *       </th>
169             *     </tr>
170             *     <tr>
171             *       <th>Namespace URI parameter</th>
172             *       <th>prefix value returned</th>
173             *     </tr>
174             *   </thead>
175             *   <tbody>
176             *     <tr>
177             *       <td>&lt;default Namespace URI&gt;</td>
178             *       <td><code>XMLConstants.DEFAULT_NS_PREFIX</code> ("")
179             *       </td>
180             *     </tr>
181             *     <tr>
182             *       <td>bound Namespace URI</td>
183             *       <td>prefix bound to Namespace URI in the current scope,
184             *           if multiple prefixes are bound to the Namespace URI in
185             *           the current scope, a single arbitrary prefix, whose
186             *           choice is implementation dependent, is returned</td>
187             *     </tr>
188             *     <tr>
189             *       <td>unbound Namespace URI</td>
190             *       <td><code>null</code></td>
191             *     </tr>
192             *     <tr>
193             *       <td><code>XMLConstants.XML_NS_URI</code>
194             *           ("http://www.w3.org/XML/1998/namespace")</td>
195             *       <td><code>XMLConstants.XML_NS_PREFIX</code> ("xml")</td>
196             *     </tr>
197             *     <tr>
198             *       <td><code>XMLConstants.XMLNS_ATTRIBUTE_NS_URI</code>
199             *           ("http://www.w3.org/2000/xmlns/")</td>
200             *       <td><code>XMLConstants.XMLNS_ATTRIBUTE</code> ("xmlns")</td>
201             *     </tr>
202             *     <tr>
203             *       <td><code>null</code></td>
204             *       <td><code>IllegalArgumentException</code> is thrown</td>
205             *     </tr>
206             *   </tbody>
207             * </table>
208             *
209             * @param namespaceURI URI of Namespace to lookup
210             *
211             * @return prefix bound to Namespace URI in current context
212             *
213             * @throws IllegalArgumentException When <code>namespaceURI</code> is
214             *   <code>null</code>
215             */
216            String getPrefix(String namespaceURI);
217
218            /**
219             * <p>Get all prefixes bound to a Namespace URI in the current
220             * scope.</p>
221             *
222             * <p>An Iterator over String elements is returned in an arbitrary,
223             * <strong>implementation dependent</strong>, order.</p>
224             *
225             * <p><strong>The <code>Iterator</code> is
226             * <em>not</em> modifiable.  e.g. the
227             * <code>remove()</code> method will throw
228             * <code>UnsupportedOperationException</code>.</strong></p>
229             *
230             * <p>When requesting prefixes by Namespace URI, the following
231             * table describes the returned prefixes value for all Namespace
232             * URI values:</p>
233             *
234             * <table border="2" rules="all" cellpadding="4">
235             *   <thead>
236             *     <tr>
237             *       <th align="center" colspan="2"><code>
238             *         getPrefixes(namespaceURI)</code> return value for
239             *         specified Namespace URIs</th>
240             *     </tr>
241             *     <tr>
242             *       <th>Namespace URI parameter</th>
243             *       <th>prefixes value returned</th>
244             *     </tr>
245             *   </thead>
246             *   <tbody>
247             *     <tr>
248             *       <td>bound Namespace URI,
249             *         including the &lt;default Namespace URI&gt;</td>
250             *       <td>
251             *         <code>Iterator</code> over prefixes bound to Namespace URI in
252             *         the current scope in an arbitrary,
253             *         <strong>implementation dependent</strong>,
254             *         order
255             *       </td>
256             *     </tr>
257             *     <tr>
258             *       <td>unbound Namespace URI</td>
259             *       <td>empty <code>Iterator</code></td>
260             *     </tr>
261             *     <tr>
262             *       <td><code>XMLConstants.XML_NS_URI</code>
263             *           ("http://www.w3.org/XML/1998/namespace")</td>
264             *       <td><code>Iterator</code> with one element set to
265             *         <code>XMLConstants.XML_NS_PREFIX</code> ("xml")</td>
266             *     </tr>
267             *     <tr>
268             *       <td><code>XMLConstants.XMLNS_ATTRIBUTE_NS_URI</code>
269             *           ("http://www.w3.org/2000/xmlns/")</td>
270             *       <td><code>Iterator</code> with one element set to
271             *         <code>XMLConstants.XMLNS_ATTRIBUTE</code> ("xmlns")</td>
272             *     </tr>
273             *     <tr>
274             *       <td><code>null</code></td>
275             *       <td><code>IllegalArgumentException</code> is thrown</td>
276             *     </tr>
277             *   </tbody>
278             * </table>
279             *
280             * @param namespaceURI URI of Namespace to lookup
281             *
282             * @return <code>Iterator</code> for all prefixes bound to the
283             *   Namespace URI in the current scope
284             *
285             * @throws IllegalArgumentException When <code>namespaceURI</code> is
286             *   <code>null</code>
287             */
288            Iterator getPrefixes(String namespaceURI);
289        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.