001 /*
002 * $Id: Name.java,v 1.3 2004/04/02 01:24:17 ofung Exp $
003 * $Revision: 1.3 $
004 * $Date: 2004/04/02 01:24:17 $
005 */
006
007 /*
008 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
009 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
010 *
011 * This code is free software; you can redistribute it and/or modify it
012 * under the terms of the GNU General Public License version 2 only, as
013 * published by the Free Software Foundation. Sun designates this
014 * particular file as subject to the "Classpath" exception as provided
015 * by Sun in the LICENSE file that accompanied this code.
016 *
017 * This code is distributed in the hope that it will be useful, but WITHOUT
018 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
019 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
020 * version 2 for more details (a copy is included in the LICENSE file that
021 * accompanied this code).
022 *
023 * You should have received a copy of the GNU General Public License version
024 * 2 along with this work; if not, write to the Free Software Foundation,
025 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
026 *
027 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
028 * CA 95054 USA or visit www.sun.com if you need additional information or
029 * have any questions.
030 */
031 package javax.xml.soap;
032
033 /**
034 * A representation of an XML name. This interface provides methods for
035 * getting the local and namespace-qualified names and also for getting the
036 * prefix associated with the namespace for the name. It is also possible
037 * to get the URI of the namespace.
038 * <P>
039 * The following is an example of a namespace declaration in an element.
040 * <PRE>
041 * <wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">
042 * </PRE>
043 * ("xmlns" stands for "XML namespace".)
044 * The following
045 * shows what the methods in the <code>Name</code> interface will return.
046 * <UL>
047 * <LI><code>getQualifiedName</code> will return "prefix:LocalName" =
048 * "WOMBAT:GetLastTradePrice"
049 * <LI><code>getURI</code> will return "http://www.wombat.org/trader"
050 * <LI><code>getLocalName</code> will return "GetLastTracePrice"
051 * <LI><code>getPrefix</code> will return "WOMBAT"
052 * </UL>
053 * <P>
054 * XML namespaces are used to disambiguate SOAP identifiers from
055 * application-specific identifiers.
056 * <P>
057 * <code>Name</code> objects are created using the method
058 * <code>SOAPEnvelope.createName</code>, which has two versions.
059 * One method creates <code>Name</code> objects with
060 * a local name, a namespace prefix, and a namespace URI.
061 * and the second creates <code>Name</code> objects with just a local name.
062 * The following line of
063 * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new
064 * <code>Name</code> object with all three.
065 * <PRE>
066 * Name name = se.createName("GetLastTradePrice", "WOMBAT",
067 * "http://www.wombat.org/trader");
068 * </PRE>
069 * The following line of code gives an example of how a <code>Name</code> object
070 * can be used. The variable <i>element</i> is a <code>SOAPElement</code> object.
071 * This code creates a new <code>SOAPElement</code> object with the given name and
072 * adds it to <i>element</i>.
073 * <PRE>
074 * element.addChildElement(name);
075 * </PRE>
076 * <P>
077 * The <code>Name</code> interface may be deprecated in a future release of SAAJ
078 * in favor of <code>javax.xml.namespace.QName</code>
079 * @see SOAPEnvelope#createName(String, String, String) SOAPEnvelope.createName
080 * @see SOAPFactory#createName(String, String, String) SOAPFactory.createName
081 */
082 public interface Name {
083 /**
084 * Gets the local name part of the XML name that this <code>Name</code>
085 * object represents.
086 *
087 * @return a string giving the local name
088 */
089 String getLocalName();
090
091 /**
092 * Gets the namespace-qualified name of the XML name that this
093 * <code>Name</code> object represents.
094 *
095 * @return the namespace-qualified name as a string
096 */
097 String getQualifiedName();
098
099 /**
100 * Returns the prefix that was specified when this <code>Name</code> object
101 * was initialized. This prefix is associated with the namespace for the XML
102 * name that this <code>Name</code> object represents.
103 *
104 * @return the prefix as a string
105 */
106 String getPrefix();
107
108 /**
109 * Returns the URI of the namespace for the XML
110 * name that this <code>Name</code> object represents.
111 *
112 * @return the URI as a string
113 */
114 String getURI();
115 }
|