📄 attr.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 Attr</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/Attr.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"> PREV CLASS <A HREF="../../../org/w3c/dom/CDATASection.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="Attr.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 Attr</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>Attr</B><DT>extends <A HREF="../../../org/w3c/dom/Node.html">Node</A></DL><P>The <code>Attr</code> interface represents an attribute in an <code>Element</code> object. Typically the allowable values for the attribute are defined in a document type definition. <p><code>Attr</code> objects inherit the <code>Node</code> interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the <code>Node</code> attributes <code>parentNode</code>, <code>previousSibling</code>, and <code>nextSibling</code> have a <code>null</code> value for <code>Attr</code> objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore, <code>Attr</code> nodes may not be immediate children of a <code>DocumentFragment</code>. However, they can be associated with <code>Element</code> nodes contained within a <code>DocumentFragment</code>. In short, users and implementors of the DOM need to be aware that <code>Attr</code> nodes have some things in common with other objects inheriting the <code>Node</code> interface, but they also are quite distinct. <p>The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the <code>nodeValue</code> attribute on the <code>Attr</code> instance can also be used to retrieve the string version of the attribute's value(s). <p>In XML, where the value of an attribute can contain entity references, the child nodes of the <code>Attr</code> node may be either <code>Text</code> or <code>EntityReference</code> nodes (when these are in use; see the description of <code>EntityReference</code> for discussion). Because the DOM Core is not aware of attribute types, it treats all attribute values as simple strings, even if the DTD or schema declares them as having tokenized types. <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/Attr.html#getName()">getName</A></B>()</CODE><BR> Returns the name of this attribute.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/w3c/dom/Element.html">Element</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/w3c/dom/Attr.html#getOwnerElement()">getOwnerElement</A></B>()</CODE><BR> The <code>Element</code> node this attribute is attached to or <code>null</code> if this attribute is not in use.</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/Attr.html#getSpecified()">getSpecified</A></B>()</CODE><BR> If this attribute was explicitly given a value in the original document, this is <code>true</code>; otherwise, it is <code>false</code>.</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/Attr.html#getValue()">getValue</A></B>()</CODE><BR> On retrieval, the value of the attribute is returned as a string.</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/Attr.html#setValue(java.lang.String)">setValue</A></B>(java.lang.String value)</CODE><BR> On retrieval, the value of the attribute is returned as a string.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_org.w3c.dom.Node"><!-- --></A>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -