📄 element.html
字号:
<PRE>public void <B>setAttributeNS</B>(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) throws <A HREF="../../../org/w3c/dom/DOMException.html">DOMException</A></PRE><DL><DD>Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the <code>qualifiedName</code>, and its value is changed to be the <code>value</code> parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an <code>Attr</code> node plus any <code>Text</code> and <code>EntityReference</code> nodes, build the appropriate subtree, and use <code>setAttributeNodeNS</code> or <code>setAttributeNode</code> to assign it as the value of an attribute.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>namespaceURI</CODE> - The namespace URI of the attribute to create or alter.<DD><CODE>qualifiedName</CODE> - The qualified name of the attribute to create or alter.<DD><CODE>value</CODE> - The value to set in string form.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/w3c/dom/DOMException.html">DOMException</A></CODE> - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character, per the XML 1.0 specification . <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is malformed per the Namespaces in XML specification, if the <code>qualifiedName</code> has a prefix and the <code>namespaceURI</code> is <code>null</code>, if the <code>qualifiedName</code> has a prefix that is "xml" and the <code>namespaceURI</code> is different from " http://www.w3.org/XML/1998/namespace", or if the <code>qualifiedName</code>, or its prefix, is "xmlns" and the <code>namespaceURI</code> is different from " http://www.w3.org/2000/xmlns/". <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not support the <code>"XML"</code> feature, since namespaces were defined by XML.<DT><B>Since: </B><DD>DOM Level 2</DD></DL></DD></DL><HR><A NAME="removeAttributeNS(java.lang.String, java.lang.String)"><!-- --></A><H3>removeAttributeNS</H3><PRE>public void <B>removeAttributeNS</B>(java.lang.String namespaceURI, java.lang.String localName) throws <A HREF="../../../org/w3c/dom/DOMException.html">DOMException</A></PRE><DL><DD>Removes an attribute by local name and namespace URI. If the removed attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix. <br>Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>namespaceURI</CODE> - The namespace URI of the attribute to remove.<DD><CODE>localName</CODE> - The local name of the attribute to remove.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/w3c/dom/DOMException.html">DOMException</A></CODE> - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<DT><B>Since: </B><DD>DOM Level 2</DD></DL></DD></DL><HR><A NAME="getAttributeNodeNS(java.lang.String, java.lang.String)"><!-- --></A><H3>getAttributeNodeNS</H3><PRE>public <A HREF="../../../org/w3c/dom/Attr.html">Attr</A> <B>getAttributeNodeNS</B>(java.lang.String namespaceURI, java.lang.String localName)</PRE><DL><DD>Retrieves an <code>Attr</code> node by local name and namespace URI. <br>Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>namespaceURI</CODE> - The namespace URI of the attribute to retrieve.<DD><CODE>localName</CODE> - The local name of the attribute to retrieve.<DT><B>Returns:</B><DD>The <code>Attr</code> node with the specified attribute local name and namespace URI or <code>null</code> if there is no such attribute.<DT><B>Since: </B><DD>DOM Level 2</DD></DL></DD></DL><HR><A NAME="setAttributeNodeNS(org.w3c.dom.Attr)"><!-- --></A><H3>setAttributeNodeNS</H3><PRE>public <A HREF="../../../org/w3c/dom/Attr.html">Attr</A> <B>setAttributeNodeNS</B>(<A HREF="../../../org/w3c/dom/Attr.html">Attr</A> newAttr) throws <A HREF="../../../org/w3c/dom/DOMException.html">DOMException</A></PRE><DL><DD>Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>newAttr</CODE> - The <code>Attr</code> node to add to the attribute list.<DT><B>Returns:</B><DD>If the <code>newAttr</code> attribute replaces an existing attribute with the same local name and namespace URI, the replaced <code>Attr</code> node is returned, otherwise <code>null</code> is returned.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/w3c/dom/DOMException.html">DOMException</A></CODE> - WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a different document than the one that created the element. <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an attribute of another <code>Element</code> object. The DOM user must explicitly clone <code>Attr</code> nodes to re-use them in other elements. <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not support the <code>"XML"</code> feature, since namespaces were defined by XML.<DT><B>Since: </B><DD>DOM Level 2</DD></DL></DD></DL><HR><A NAME="getElementsByTagNameNS(java.lang.String, java.lang.String)"><!-- --></A><H3>getElementsByTagNameNS</H3><PRE>public <A HREF="../../../org/w3c/dom/NodeList.html">NodeList</A> <B>getElementsByTagNameNS</B>(java.lang.String namespaceURI, java.lang.String localName)</PRE><DL><DD>Returns a <code>NodeList</code> of all the descendant <code>Elements</code> with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this <code>Element</code> tree. <br>Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>namespaceURI</CODE> - The namespace URI of the elements to match on. The special value "*" matches all namespaces.<DD><CODE>localName</CODE> - The local name of the elements to match on. The special value "*" matches all local names.<DT><B>Returns:</B><DD>A new <code>NodeList</code> object containing all the matched <code>Elements</code>.<DT><B>Since: </B><DD>DOM Level 2</DD></DL></DD></DL><HR><A NAME="hasAttribute(java.lang.String)"><!-- --></A><H3>hasAttribute</H3><PRE>public boolean <B>hasAttribute</B>(java.lang.String name)</PRE><DL><DD>Returns <code>true</code> when an attribute with a given name is specified on this element or has a default value, <code>false</code> otherwise.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of the attribute to look for.<DT><B>Returns:</B><DD><code>true</code> if an attribute with the given name is specified on this element or has a default value, <code>false</code> otherwise.<DT><B>Since: </B><DD>DOM Level 2</DD></DL></DD></DL><HR><A NAME="hasAttributeNS(java.lang.String, java.lang.String)"><!-- --></A><H3>hasAttributeNS</H3><PRE>public boolean <B>hasAttributeNS</B>(java.lang.String namespaceURI, java.lang.String localName)</PRE><DL><DD>Returns <code>true</code> when an attribute with a given local name and namespace URI is specified on this element or has a default value, <code>false</code> otherwise. <br>Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>namespaceURI</CODE> - The namespace URI of the attribute to look for.<DD><CODE>localName</CODE> - The local name of the attribute to look for.<DT><B>Returns:</B><DD><code>true</code> if an attribute with the given local name and namespace URI is specified or has a default value on this element, <code>false</code> otherwise.<DT><B>Since: </B><DD>DOM Level 2</DD></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/Element.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/w3c/dom/DOMImplementation.html"><B>PREV CLASS</B></A> <A HREF="../../../org/w3c/dom/Entity.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="Element.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <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 + -