001    /*
002     * Copyright 2001-2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package javax.xml.soap;
017    
018    /**
019     * A representation of an XML name.  This interface provides methods for
020     * getting the local and namespace-qualified names and also for getting the
021     * prefix associated with the namespace for the name. It is also possible
022     * to get the URI of the namespace.
023     * <P>
024     * The following is an example of a namespace declaration in an element.
025     * <PRE>
026     *  &lt;wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader"&gt;
027     * </PRE>
028     * ("xmlns" stands for "XML namespace".)
029     * The following
030     * shows what the methods in the <code>Name</code> interface will return.
031     * <UL>
032     * <LI><code>getQualifiedName</code> will return "prefix:LocalName" =
033     *     "WOMBAT:GetLastTradePrice"
034     * <LI><code>getURI</code> will return "http://www.wombat.org/trader"
035     * <LI><code>getLocalName</code> will return "GetLastTracePrice"
036     * <LI><code>getPrefix</code> will return "WOMBAT"
037     * </UL>
038     * <P>
039     * XML namespaces are used to disambiguate SOAP identifiers from
040     * application-specific identifiers.
041     * <P>
042     * <code>Name</code> objects are created using the method
043     * <code>SOAPEnvelope.createName</code>, which has two versions.
044     * One method creates <code>Name</code> objects with
045     * a local name, a namespace prefix, and a namespace URI.
046     * and the second creates <code>Name</code> objects with just a local name.
047     * The following line of
048     * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new
049     * <code>Name</code> object with all three.
050     * <PRE>
051     *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
052     *                               "http://www.wombat.org/trader");
053     * </PRE>
054     * The following line of code gives an example of how a <code>Name</code> object
055     * can be used. The variable <i>element</i> is a <code>SOAPElement</code> object.
056     * This code creates a new <code>SOAPElement</code> object with the given name and
057     * adds it to <i>element</i>.
058     * <PRE>
059     *    element.addChildElement(name);
060     * </PRE>
061     */
062    public interface Name {
063    
064        /**
065         * Gets the local name part of the XML name that this <code>Name</code>
066         * object represents.
067         * @return  a string giving the local name
068         */
069        public abstract String getLocalName();
070    
071        /**
072         * Gets the namespace-qualified name of the XML name that this
073         * <code>Name</code> object represents.
074         * @return  the namespace-qualified name as a string
075         */
076        public abstract String getQualifiedName();
077    
078        /**
079         * Returns the prefix associated with the namespace for the XML
080         * name that this <code>Name</code> object represents.
081         * @return  the prefix as a string
082         */
083        public abstract String getPrefix();
084    
085        /**
086         * Returns the URI of the namespace for the XML
087         * name that this <code>Name</code> object represents.
088         * @return  the URI as a string
089         */
090        public abstract String getURI();
091    }