📄 qname.html
字号:
explicitly defined Namespace as defined by the <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">Namespaces in XML</a> specification. This action preserves compatible behavior with QName 1.0.</p> <p>If the local part is <code>null</code>, an <code>IllegalArgumentException</code> is thrown.</p> <p>If the prefix is <code>null</code>, an <code>IllegalArgumentException</code> is thrown. Use "" to explicitly indicate that no prefix is present or the prefix is not relevant.</p><P><DT><B>Parameters:</B><DD><CODE>namespaceURI</CODE> - Namespace URI of the <code>QName<code><DD><CODE>localPart</CODE> - local part of the <code>QName<code><DD><CODE>prefix</CODE> - prefix of the <code>QName<code></DL><HR><A NAME="QName(java.lang.String)"><!-- --></A><H3>QName</H3><PRE>public <B>QName</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> localPart)</PRE><DL><DD><p><code>QName</code> constructor specifying the local part.</p> <p>If the local part is <code>null</code> or <code>.equals("")</code>, an <code>IllegalArgumentException</code> is thrown.</p> <p>When using this constructor, the Namespace URI is set to "" and the prefix is set to "".</p> <p><em>In an XML context, all Element and Attribute names exist in the context of a Namespace. Making this explicit during the construction of a <code>QName</code> helps to prevent hard to diagnosis XML validity errors. The constructors <A HREF="../../../javax/xml/namespace/QName.html#QName(java.lang.String, java.lang.String)"><CODE>QName(String namespaceURI, String localPart)</CODE></A> and <A HREF="../../../javax/xml/namespace/QName.html#QName(java.lang.String, java.lang.String, java.lang.String)"><CODE>QName(String namespaceURI, String localPart, String prefix)</CODE></A> are preferred.</em></p><P><DT><B>Parameters:</B><DD><CODE>localPart</CODE> - local part of the <code>QName</code><DT><B>See Also:</B><DD><A HREF="../../../javax/xml/namespace/QName.html#QName(java.lang.String, java.lang.String)"><CODE>QName(String namespaceURI, String localPart)</CODE></A>, <A HREF="../../../javax/xml/namespace/QName.html#QName(java.lang.String, java.lang.String, java.lang.String)"><CODE>QName(String namespaceURI, String localPart, String prefix)</CODE></A></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getNamespaceURI()"><!-- --></A><H3>getNamespaceURI</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getNamespaceURI</B>()</PRE><DL><DD><p>Get the Namespace URI of this <code>QName</code>.</p><P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>Namespace URI of this <code>QName</code></DL></DD></DL><HR><A NAME="getLocalPart()"><!-- --></A><H3>getLocalPart</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getLocalPart</B>()</PRE><DL><DD><p>Get the local part of this <code>QName</code>.</p><P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>local part of this <code>QName</code></DL></DD></DL><HR><A NAME="getPrefix()"><!-- --></A><H3>getPrefix</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getPrefix</B>()</PRE><DL><DD><p>Get the prefix of this <code>QName</code>.</p> <p>The prefix assigned to a <code>QName</code> may <strong><em>NOT</em></strong> be valid in a different context. For example, a <code>QName</code> may be assigned a prefix in the context of parsing a document but that prefix may be invalid in the context of a different document.</p><P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>prefix of this <code>QName</code></DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> objectToTest)</PRE><DL><DD><p>Test this <code>QName</code> for equality with another <code>Object</code>.</p> <p>If the <code>Object</code> to be tested is not a <code>QName</code> or is <code>null</code>, then this method returns <code>false</code>.</p> <p>Two <code>QName</code>s are considered equal if and only if both the Namespace URI and local part are equal. This method uses <code>String.equals()</code> to check equality of the Namespace URI and local part. The prefix is <strong><em>NOT</em></strong> used to determine equality.</p> <p>This method satisfies the general contract of <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang"><CODE>Object.equals(Object)</CODE></A></p><P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>objectToTest</CODE> - the <code>Object</code> to test for equality with this <code>QName</code><DT><B>Returns:</B><DD><code>true</code> if the given <code>Object</code> is equal to this <code>QName</code> else <code>false</code></DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD><p>Generate the hash code for this <code>QName</code>.</p> <p>The hash code is calculated using both the Namespace URI and the local part of the <code>QName</code>. The prefix is <strong><em>NOT</em></strong> used to calculate the hash code.</p> <p>This method satisfies the general contract of <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang"><CODE>Object.hashCode()</CODE></A>.</p><P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>hash code for this <code>QName</code> <code>Object</code></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE><DL><DD><p><code>String</code> representation of this <code>QName</code>.</p> <p><em>There is <strong>NO</strong> standard specification for representing a <code>QName</code> as a <code>String</code>. The returned <code>String</code> is not portable across implementations and will change when a standard <code>String</code> representation is defined. This implementation currently represents a <code>QName</code> as: "{" + Namespace URI + "}" + local part. If the Namespace URI <code>.equals("")</code>, only the local part is returned. An appropriate use of this method is for debugging or logging for human consumption.</em></p> <p>Note the prefix value is <strong><em>NOT</em></strong> returned as part of the <code>String</code> representation.</p> <p>This method satisfies the general contract of <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang"><CODE>Object.toString()</CODE></A>.</p><P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>String</code> representation of this <code>QName</code></DL></DD></DL><HR><A NAME="valueOf(java.lang.String)"><!-- --></A><H3>valueOf</H3><PRE>public static <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace">QName</A> <B>valueOf</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> qNameAsString)</PRE><DL><DD><p><code>QName</code> derived from parsing the formatted <code>String</code>.</p> <p>If the <code>String</code> is <code>null</code> or does not conform to <A HREF="../../../javax/xml/namespace/QName.html#toString()"><CODE>QName.toString()</CODE></A> formatting, an <code>IllegalArgumentException</code> is thrown.</p> <p><em>The <code>String</code> <strong>MUST</strong> be in the form returned by <A HREF="../../../javax/xml/namespace/QName.html#toString()"><CODE>QName.toString()</CODE></A>. There is <strong>NO</strong> standard specification for representing a <code>QName</code> as a <code>String</code>. The <code>String</code> format is <strong>NOT</strong> portable across implementations and will change when a standard <code>String</code> representation is defined. This implementation currently parses a <code>String</code> formatted as: "{" + Namespace URI + "}" + local part. If the Namespace URI <code>.equals("")</code>, only the local part should be provided.</em></p> <p>The prefix value <strong><em>CANNOT</em></strong> be represented in the <code>String</code> and will be set to ""</p> <p>This method does not do full validation of the resulting <code>QName</code>. In particular, the local part is not validated as a <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a> as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>.</p><P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>qNameAsString</CODE> - <code>String</code> representation of the <code>QName</code><DT><B>Returns:</B><DD><code>QName</code> corresponding to the given <code>String</code><DT><B>See Also:</B><DD><A HREF="../../../javax/xml/namespace/QName.html#toString()"><CODE>QName.toString()</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Ent. Ed. v1.4</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="QName.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -