001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package org.jvnet.staxex;
038:
039: import javax.xml.namespace.NamespaceContext;
040: import java.util.Iterator;
041:
042: /**
043: * Extended {@link NamespaceContext}.
044: *
045: * @author Kohsuke Kawaguchi
046: * @author Paul Sandoz
047: */
048: public interface NamespaceContextEx extends NamespaceContext,
049: Iterable<NamespaceContextEx.Binding> {
050:
051: /**
052: * Iterates all the in-scope namespace bindings.
053: *
054: * <p>
055: * This method enumerates all the active in-scope namespace bindings.
056: * This does not include implicit bindings, such as
057: * <tt>"xml"->"http://www.w3.org/XML/1998/namespace"</tt>
058: * or <tt>""->""</tt> (the implicit default namespace URI.)
059: *
060: * <p>
061: * The returned iterator may not include the same prefix more than once.
062: * For example, the returned iterator may only contain <tt>f=ns2</tt>
063: * if the document is as follows and this method is used at the bar element.
064: *
065: * <pre><xmp>
066: * <foo xmlns:f='ns1'>
067: * <bar xmlns:f='ns2'>
068: * ...
069: * </xmp></pre>
070: *
071: * <p>
072: * The iteration may be done in no particular order.
073: *
074: * @return
075: * may return an empty iterator, but never null.
076: */
077: Iterator<Binding> iterator();
078:
079: /**
080: * Prefix to namespace URI binding.
081: */
082: interface Binding {
083: /**
084: * Gets the prefix.
085: *
086: * <p>
087: * The default namespace URI is represented by using an
088: * empty string "", not null.
089: *
090: * @return
091: * never null. String like "foo", "ns12", or "".
092: */
093: String getPrefix();
094:
095: /**
096: * Gets the namespace URI.
097: *
098: * <p>
099: * The empty namespace URI is represented by using
100: * an empty string "", not null.
101: *
102: * @return
103: * never null. String like "http://www.w3.org/XML/1998/namespace",
104: * "urn:oasis:names:specification:docbook:dtd:xml:4.1.2", or "".
105: */
106: String getNamespaceURI();
107: }
108: }
|