📄 element.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Wed Oct 31 22:26:25 PST 2001 --><TITLE>Java API for XML Processing Specification 1.1: Interface Element</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.w3c.dom</FONT><BR>Interface Element</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../../../org/w3c/dom/Node.html">Node</A></DD></DL><HR><DL><DT>public interface <B>Element</B><DT>extends <A HREF="../../../org/w3c/dom/Node.html">Node</A></DL><P>The <code>Element</code> interface represents an element in an HTML or XML document. Elements may have attributes associated with them; since the <code>Element</code> interface inherits from <code>Node</code>, the generic <code>Node</code> interface attribute <code>attributes</code> may be used to retrieve the set of all attributes for an element. There are methods on the <code>Element</code> interface to retrieve either an <code>Attr</code> object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an <code>Attr</code> object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.In DOM Level 2, the method <code>normalize</code> is inherited from the <code>Node</code> interface where it was moved. <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_org.w3c.dom.Node"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface org.w3c.dom.<A HREF="../../../org/w3c/dom/Node.html">Node</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../org/w3c/dom/Node.html#ATTRIBUTE_NODE">ATTRIBUTE_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#CDATA_SECTION_NODE">CDATA_SECTION_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#COMMENT_NODE">COMMENT_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#DOCUMENT_FRAGMENT_NODE">DOCUMENT_FRAGMENT_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#DOCUMENT_NODE">DOCUMENT_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#DOCUMENT_TYPE_NODE">DOCUMENT_TYPE_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#ELEMENT_NODE">ELEMENT_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#ENTITY_NODE">ENTITY_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#ENTITY_REFERENCE_NODE">ENTITY_REFERENCE_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#NOTATION_NODE">NOTATION_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#PROCESSING_INSTRUCTION_NODE">PROCESSING_INSTRUCTION_NODE</A>, <A HREF="../../../org/w3c/dom/Node.html#TEXT_NODE">TEXT_NODE</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getAttribute(java.lang.String)">getAttribute</A></B>(java.lang.String name)</CODE><BR> Retrieves an attribute value by name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/Attr.html">Attr</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getAttributeNode(java.lang.String)">getAttributeNode</A></B>(java.lang.String name)</CODE><BR> Retrieves an attribute node by name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/Attr.html">Attr</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getAttributeNodeNS(java.lang.String, java.lang.String)">getAttributeNodeNS</A></B>(java.lang.String namespaceURI, java.lang.String localName)</CODE><BR> Retrieves an <code>Attr</code> node by local name and namespace URI.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getAttributeNS(java.lang.String, java.lang.String)">getAttributeNS</A></B>(java.lang.String namespaceURI, java.lang.String localName)</CODE><BR> Retrieves an attribute value by local name and namespace URI.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/NodeList.html">NodeList</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getElementsByTagName(java.lang.String)">getElementsByTagName</A></B>(java.lang.String name)</CODE><BR> Returns a <code>NodeList</code> of all descendant <code>Elements</code> with a given tag name, in the order in which they are encountered in a preorder traversal of this <code>Element</code> tree.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/NodeList.html">NodeList</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getElementsByTagNameNS(java.lang.String, java.lang.String)">getElementsByTagNameNS</A></B>(java.lang.String namespaceURI, java.lang.String localName)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#getTagName()">getTagName</A></B>()</CODE><BR> The name of the element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#hasAttribute(java.lang.String)">hasAttribute</A></B>(java.lang.String name)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#hasAttributeNS(java.lang.String, java.lang.String)">hasAttributeNS</A></B>(java.lang.String namespaceURI, java.lang.String localName)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#removeAttribute(java.lang.String)">removeAttribute</A></B>(java.lang.String name)</CODE><BR> Removes an attribute by name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/Attr.html">Attr</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#removeAttributeNode(org.w3c.dom.Attr)">removeAttributeNode</A></B>(<A HREF="../../../org/w3c/dom/Attr.html">Attr</A> oldAttr)</CODE><BR> Removes the specified attribute node.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#removeAttributeNS(java.lang.String, java.lang.String)">removeAttributeNS</A></B>(java.lang.String namespaceURI, java.lang.String localName)</CODE><BR> Removes an attribute by local name and namespace URI.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#setAttribute(java.lang.String, java.lang.String)">setAttribute</A></B>(java.lang.String name, java.lang.String value)</CODE><BR> Adds a new attribute.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/Attr.html">Attr</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Element.html#setAttributeNode(org.w3c.dom.Attr)">setAttributeNode</A></B>(<A HREF="../../../org/w3c/dom/Attr.html">Attr</A> newAttr)</CODE><BR> Adds a new attribute node.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -