📄 namespacesupport.html
字号:
</TR></TABLE><A NAME="NamespaceSupport()"><!-- --></A><H3>NamespaceSupport</H3><PRE>public <B>NamespaceSupport</B>()</PRE><DL><DD>Create a new Namespace support object.</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="reset()"><!-- --></A><H3>reset</H3><PRE>public void <B>reset</B>()</PRE><DL><DD>Reset this Namespace support object for reuse. <p>It is necessary to invoke this method before reusing the Namespace support object for a new session.</p></DL><HR><A NAME="pushContext()"><!-- --></A><H3>pushContext</H3><PRE>public void <B>pushContext</B>()</PRE><DL><DD>Start a new Namespace context. <p>Normally, you should push a new context at the beginning of each XML element: the new context will automatically inherit the declarations of its parent context, but it will also keep track of which declarations were made within this context.</p> <p>The Namespace support object always starts with a base context already in force: in this context, only the "xml" prefix is declared.</p><DD><DL><DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#popContext()"><CODE>popContext()</CODE></A></DL></DD></DL><HR><A NAME="popContext()"><!-- --></A><H3>popContext</H3><PRE>public void <B>popContext</B>()</PRE><DL><DD>Revert to the previous Namespace context. <p>Normally, you should pop the context at the end of each XML element. After popping the context, all Namespace prefix mappings that were previously in force are restored.</p> <p>You must not attempt to declare additional Namespace prefixes after popping a context, unless you push another context first.</p><DD><DL><DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#pushContext()"><CODE>pushContext()</CODE></A></DL></DD></DL><HR><A NAME="declarePrefix(java.lang.String, java.lang.String)"><!-- --></A><H3>declarePrefix</H3><PRE>public boolean <B>declarePrefix</B>(java.lang.String prefix, java.lang.String uri)</PRE><DL><DD>Declare a Namespace prefix. <p>This method declares a prefix in the current Namespace context; the prefix will remain in force until this context is popped, unless it is shadowed in a descendant context.</p> <p>To declare a default Namespace, use the empty string. The prefix must not be "xml" or "xmlns".</p> <p>Note that you must <em>not</em> declare a prefix after you've pushed and popped another Namespace.</p> <p>Note that there is an asymmetry in this library: while <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefix(java.lang.String)"><CODE>getPrefix</CODE></A> will not return the default "" prefix, even if you have declared one; to check for a default prefix, you have to look it up explicitly using <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI</CODE></A>. This asymmetry exists to make it easier to look up prefixes for attribute names, where the default prefix is not allowed.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>prefix</CODE> - The prefix to declare, or null for the empty string.<DD><CODE>uri</CODE> - The Namespace URI to associate with the prefix.<DT><B>Returns:</B><DD>true if the prefix was legal, false otherwise<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#processName(java.lang.String, java.lang.String[], boolean)"><CODE>processName(java.lang.String, java.lang.String[], boolean)</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI(java.lang.String)</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefix(java.lang.String)"><CODE>getPrefix(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="processName(java.lang.String, java.lang.String[], boolean)"><!-- --></A><H3>processName</H3><PRE>public java.lang.String[] <B>processName</B>(java.lang.String qName, java.lang.String[] parts, boolean isAttribute)</PRE><DL><DD>Process a raw XML 1.0 name. <p>This method processes a raw XML 1.0 name in the current context by removing the prefix and looking it up among the prefixes currently declared. The return value will be the array supplied by the caller, filled in as follows:</p> <dl> <dt>parts[0]</dt> <dd>The Namespace URI, or an empty string if none is in use.</dd> <dt>parts[1]</dt> <dd>The local name (without prefix).</dd> <dt>parts[2]</dt> <dd>The original raw name.</dd> </dl> <p>All of the strings in the array will be internalized. If the raw name has a prefix that has not been declared, then the return value will be null.</p> <p>Note that attribute names are processed differently than element names: an unprefixed element name will received the default Namespace (if any), while an unprefixed element name will not.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>qName</CODE> - The raw XML 1.0 name to be processed.<DD><CODE>parts</CODE> - An array supplied by the caller, capable of holding at least three members.<DD><CODE>isAttribute</CODE> - A flag indicating whether this is an attribute name (true) or an element name (false).<DT><B>Returns:</B><DD>The supplied array holding three internalized strings representing the Namespace URI (or empty string), the local name, and the raw XML 1.0 name; or null if there is an undeclared prefix.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#declarePrefix(java.lang.String, java.lang.String)"><CODE>declarePrefix(java.lang.String, java.lang.String)</CODE></A>, <CODE>String.intern()</CODE></DL></DD></DL><HR><A NAME="getURI(java.lang.String)"><!-- --></A><H3>getURI</H3><PRE>public java.lang.String <B>getURI</B>(java.lang.String prefix)</PRE><DL><DD>Look up a prefix and get the currently-mapped Namespace URI. <p>This method looks up the prefix in the current context. Use the empty string ("") for the default Namespace.</p><DD><DL><DT><B>Parameters:</B><DD><CODE>prefix</CODE> - The prefix to look up.<DT><B>Returns:</B><DD>The associated Namespace URI, or null if the prefix is undeclared in this context.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefix(java.lang.String)"><CODE>getPrefix(java.lang.String)</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefixes()"><CODE>getPrefixes()</CODE></A></DL></DD></DL><HR><A NAME="getPrefixes()"><!-- --></A><H3>getPrefixes</H3><PRE>public java.util.Enumeration <B>getPrefixes</B>()</PRE><DL><DD>Return an enumeration of all prefixes currently declared. <p><strong>Note:</strong> if there is a default prefix, it will not be returned in this enumeration; check for the default prefix using the <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI</CODE></A> with an argument of "".</p><DD><DL><DT><B>Returns:</B><DD>An enumeration of all prefixes declared in the current context except for the empty (default) prefix.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getDeclaredPrefixes()"><CODE>getDeclaredPrefixes()</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getPrefix(java.lang.String)"><!-- --></A><H3>getPrefix</H3><PRE>public java.lang.String <B>getPrefix</B>(java.lang.String uri)</PRE><DL><DD>Return one of the prefixes mapped to a Namespace URI. <p>If more than one prefix is currently mapped to the same URI, this method will make an arbitrary selection; if you want all of the prefixes, use the <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefixes()"><CODE>getPrefixes()</CODE></A> method instead.</p> <p><strong>Note:</strong> this will never return the empty (default) prefix; to check for a default prefix, use the <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI</CODE></A> method with an argument of "".</p><DD><DL><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI.<DD><CODE>isAttribute</CODE> - true if this prefix is for an attribute (and the default Namespace is not allowed).<DT><B>Returns:</B><DD>One of the prefixes currently mapped to the URI supplied, or null if none is mapped or if the URI is assigned to the default Namespace.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefixes(java.lang.String)"><CODE>getPrefixes(java.lang.String)</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getPrefixes(java.lang.String)"><!-- --></A><H3>getPrefixes</H3><PRE>public java.util.Enumeration <B>getPrefixes</B>(java.lang.String uri)</PRE><DL><DD>Return an enumeration of all prefixes currently declared for a URI. <p>This method returns prefixes mapped to a specific Namespace URI. The xml: prefix will be included. If you want only one prefix that's mapped to the Namespace URI, and you don't care which one you get, use the <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefix(java.lang.String)"><CODE>getPrefix</CODE></A> method instead.</p> <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included in this enumeration; to check for the presence of a default Namespace, use the <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI</CODE></A> method with an argument of "".</p><DD><DL><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI.<DT><B>Returns:</B><DD>An enumeration of all prefixes declared in the current context.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefix(java.lang.String)"><CODE>getPrefix(java.lang.String)</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getDeclaredPrefixes()"><CODE>getDeclaredPrefixes()</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getDeclaredPrefixes()"><!-- --></A><H3>getDeclaredPrefixes</H3><PRE>public java.util.Enumeration <B>getDeclaredPrefixes</B>()</PRE><DL><DD>Return an enumeration of all prefixes declared in this context. <p>The empty (default) prefix will be included in this enumeration; note that this behaviour differs from that of <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefix(java.lang.String)"><CODE>getPrefix(java.lang.String)</CODE></A> and <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefixes()"><CODE>getPrefixes()</CODE></A>.</p><DD><DL><DT><B>Returns:</B><DD>An enumeration of all prefixes declared in this context.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getPrefixes()"><CODE>getPrefixes()</CODE></A>, <A HREF="../../../../org/xml/sax/helpers/NamespaceSupport.html#getURI(java.lang.String)"><CODE>getURI(java.lang.String)</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <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="class-use/NamespaceSupport.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../org/xml/sax/helpers/LocatorImpl.html"><B>PREV CLASS</B></A> <A HREF="../../../../org/xml/sax/helpers/ParserAdapter.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="NamespaceSupport.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -