1 /* 2 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.xml.soap; 27 28 /** 29 * A representation of an XML name. This interface provides methods for 30 * getting the local and namespace-qualified names and also for getting the 31 * prefix associated with the namespace for the name. It is also possible 32 * to get the URI of the namespace. 33 * <P> 34 * The following is an example of a namespace declaration in an element. 35 * {@code <wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">} 36 * ("xmlns" stands for "XML namespace".) 37 * The following 38 * shows what the methods in the {@code Name} interface will return. 39 * <UL> 40 * <LI>{@code getQualifiedName} will return "prefix:LocalName" = 41 * "WOMBAT:GetLastTradePrice" 42 * <LI>{@code getURI} will return "http://www.wombat.org/trader" 43 * <LI>{@code getLocalName} will return "GetLastTracePrice" 44 * <LI>{@code getPrefix} will return "WOMBAT" 45 * </UL> 46 * <P> 47 * XML namespaces are used to disambiguate SOAP identifiers from 48 * application-specific identifiers. 49 * <P> 50 * {@code Name} objects are created using the method 51 * {@code SOAPEnvelope.createName}, which has two versions. 52 * One method creates {@code Name} objects with 53 * a local name, a namespace prefix, and a namespace URI. 54 * and the second creates {@code Name} objects with just a local name. 55 * The following line of 56 * code, in which <i>se</i> is a {@code SOAPEnvelope} object, creates a new 57 * {@code Name} object with all three. 58 * <PRE> 59 * Name name = se.createName("GetLastTradePrice", "WOMBAT", 60 * "http://www.wombat.org/trader"); 61 * </PRE> 62 * The following line of code gives an example of how a {@code Name} object 63 * can be used. The variable <i>element</i> is a {@code SOAPElement} object. 64 * This code creates a new {@code SOAPElement} object with the given name and 65 * adds it to <i>element</i>. 66 * <PRE> 67 * element.addChildElement(name); 68 * </PRE> 69 * <P> 70 * The {@code Name} interface may be deprecated in a future release of SAAJ 71 * in favor of {@code javax.xml.namespace.QName} 72 * @see SOAPEnvelope#createName(String, String, String) SOAPEnvelope.createName 73 * @see SOAPFactory#createName(String, String, String) SOAPFactory.createName 74 * @since 1.6 75 */ 76 public interface Name { 77 /** 78 * Gets the local name part of the XML name that this {@code Name} 79 * object represents. 80 * 81 * @return a string giving the local name 82 */ 83 String getLocalName(); 84 85 /** 86 * Gets the namespace-qualified name of the XML name that this 87 * {@code Name} object represents. 88 * 89 * @return the namespace-qualified name as a string 90 */ 91 String getQualifiedName(); 92 93 /** 94 * Returns the prefix that was specified when this {@code Name} object 95 * was initialized. This prefix is associated with the namespace for the XML 96 * name that this {@code Name} object represents. 97 * 98 * @return the prefix as a string 99 */ 100 String getPrefix(); 101 102 /** 103 * Returns the URI of the namespace for the XML 104 * name that this {@code Name} object represents. 105 * 106 * @return the URI as a string 107 */ 108 String getURI(); 109 }