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 * <PRE> 36 * <wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader"> 37 * </PRE> 38 * ("xmlns" stands for "XML namespace".) 39 * The following 40 * shows what the methods in the <code>Name</code> interface will return. 41 * <UL> 42 * <LI><code>getQualifiedName</code> will return "prefix:LocalName" = 43 * "WOMBAT:GetLastTradePrice" 44 * <LI><code>getURI</code> will return "http://www.wombat.org/trader" 45 * <LI><code>getLocalName</code> will return "GetLastTracePrice" 46 * <LI><code>getPrefix</code> will return "WOMBAT" 47 * </UL> 48 * <P> 49 * XML namespaces are used to disambiguate SOAP identifiers from 50 * application-specific identifiers. 51 * <P> 52 * <code>Name</code> objects are created using the method 53 * <code>SOAPEnvelope.createName</code>, which has two versions. 54 * One method creates <code>Name</code> objects with 55 * a local name, a namespace prefix, and a namespace URI. 56 * and the second creates <code>Name</code> objects with just a local name. 57 * The following line of 58 * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new 59 * <code>Name</code> object with all three. 60 * <PRE> 61 * Name name = se.createName("GetLastTradePrice", "WOMBAT", 62 * "http://www.wombat.org/trader"); 63 * </PRE> 64 * The following line of code gives an example of how a <code>Name</code> object 65 * can be used. The variable <i>element</i> is a <code>SOAPElement</code> object. 66 * This code creates a new <code>SOAPElement</code> object with the given name and 67 * adds it to <i>element</i>. 68 * <PRE> 69 * element.addChildElement(name); 70 * </PRE> 71 * <P> 72 * The <code>Name</code> interface may be deprecated in a future release of SAAJ 73 * in favor of <code>javax.xml.namespace.QName<code> 74 * @see SOAPEnvelope#createName(String, String, String) SOAPEnvelope.createName 75 * @see SOAPFactory#createName(String, String, String) SOAPFactory.createName 76 * @since 1.6 77 */ 78 public interface Name { 79 /** 80 * Gets the local name part of the XML name that this <code>Name</code> 81 * object represents. 82 * 83 * @return a string giving the local name 84 */ 85 String getLocalName(); 86 87 /** 88 * Gets the namespace-qualified name of the XML name that this 89 * <code>Name</code> object represents. 90 * 91 * @return the namespace-qualified name as a string 92 */ 93 String getQualifiedName(); 94 95 /** 96 * Returns the prefix that was specified when this <code>Name</code> object 97 * was initialized. This prefix is associated with the namespace for the XML 98 * name that this <code>Name</code> object represents. 99 * 100 * @return the prefix as a string 101 */ 102 String getPrefix(); 103 104 /** 105 * Returns the URI of the namespace for the XML 106 * name that this <code>Name</code> object represents. 107 * 108 * @return the URI as a string 109 */ 110 String getURI(); 111 } | 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 } |