<HTML> <HEAD> <TITLE>class Element</TITLE> <META NAME="Generator" CONTENT="KDOC "> </HEAD> <BODY bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink= "#ffffff"> <TABLE WIDTH="100%" BORDER="0"> <TR> <TD> <TABLE BORDER="0"> <TR><TD valign="top" align="left" cellspacing="10"> <h1>class Element</h1> </TD> <TD valign="top" align="right" colspan="1"> By far the vast majority of objects (apart from text) that authors encounter when traversing a document are <code> Element </code> nodes. <small><A HREF="#longdesc">More...</A></small></TD></TR> </TABLE> <HR> <TABLE BORDER="0"> <TR><TH>Full name</TH><TD><code><A HREF="DOM.html">DOM</A>::Element</code></TD></TR> <TR><TH>Definition</TH><TD><code>#include <<A HREF="dom__element_h.html">dom_element.h</A>></code></TD></TR> <TR><TH>Inherits</TH><TD><A HREF="DOM__Node.html">DOM::Node</A> <small>[public ]</small></TD></TR> <TR><TH>Inherited by</TH><TD><A HREF="DOM__HTMLAnchorElement.html">HTMLAnchorElement</A>, <A HREF="DOM__HTMLAppletElement.html">HTMLAppletElement</A>, <A HREF="DOM__HTMLAreaElement.html">HTMLAreaElement</A>, <A HREF="DOM__HTMLBRElement.html">HTMLBRElement</A>, <A HREF="DOM__HTMLBaseElement.html">HTMLBaseElement</A>, <A HREF="DOM__HTMLBaseFontElement.html">HTMLBaseFontElement</A>, <A HREF="DOM__HTMLBlockquoteElement.html">HTMLBlockquoteElement</A>, <A HREF="DOM__HTMLBodyElement.html">HTMLBodyElement</A>, <A HREF="DOM__HTMLButtonElement.html">HTMLButtonElement</A>, <A HREF="DOM__HTMLDListElement.html">HTMLDListElement</A>, <A HREF="DOM__HTMLDirectoryElement.html">HTMLDirectoryElement</A>, <A HREF="DOM__HTMLDivElement.html">HTMLDivElement</A>, <A HREF="DOM__HTMLElement.html">HTMLElement</A>, <A HREF="DOM__HTMLFieldSetElement.html">HTMLFieldSetElement</A>, <A HREF="DOM__HTMLFontElement.html">HTMLFontElement</A>, <A HREF="DOM__HTMLFormElement.html">HTMLFormElement</A>, <A HREF="DOM__HTMLFrameElement.html">HTMLFrameElement</A>, <A HREF="DOM__HTMLFrameSetElement.html">HTMLFrameSetElement</A>, <A HREF="DOM__HTMLHRElement.html">HTMLHRElement</A>, <A HREF="DOM__HTMLHeadElement.html">HTMLHeadElement</A>, <A HREF="DOM__HTMLHeadingElement.html">HTMLHeadingElement</A>, <A HREF="DOM__HTMLHtmlElement.html">HTMLHtmlElement</A>, <A HREF="DOM__HTMLIFrameElement.html">HTMLIFrameElement</A>, <A HREF="DOM__HTMLImageElement.html">HTMLImageElement</A>, <A HREF="DOM__HTMLInputElement.html">HTMLInputElement</A>, <A HREF="DOM__HTMLIsIndexElement.html">HTMLIsIndexElement</A>, <A HREF="DOM__HTMLLIElement.html">HTMLLIElement</A>, <A HREF="DOM__HTMLLabelElement.html">HTMLLabelElement</A>, <A HREF="DOM__HTMLLegendElement.html">HTMLLegendElement</A>, <A HREF="DOM__HTMLLinkElement.html">HTMLLinkElement</A>, <A HREF="DOM__HTMLMapElement.html">HTMLMapElement</A>, <A HREF="DOM__HTMLMenuElement.html">HTMLMenuElement</A>, <A HREF="DOM__HTMLMetaElement.html">HTMLMetaElement</A>, <A HREF="DOM__HTMLModElement.html">HTMLModElement</A>, <A HREF="DOM__HTMLOListElement.html">HTMLOListElement</A>, <A HREF="DOM__HTMLObjectElement.html">HTMLObjectElement</A>, <A HREF="DOM__HTMLOptGroupElement.html">HTMLOptGroupElement</A>, <A HREF="DOM__HTMLOptionElement.html">HTMLOptionElement</A>, <A HREF="DOM__HTMLParagraphElement.html">HTMLParagraphElement</A>, <A HREF="DOM__HTMLParamElement.html">HTMLParamElement</A>, <A HREF="DOM__HTMLPreElement.html">HTMLPreElement</A>, <A HREF="DOM__HTMLQuoteElement.html">HTMLQuoteElement</A>, <A HREF="DOM__HTMLScriptElement.html">HTMLScriptElement</A>, <A HREF="DOM__HTMLSelectElement.html">HTMLSelectElement</A>, <A HREF="DOM__HTMLStyleElement.html">HTMLStyleElement</A>, <A HREF="DOM__HTMLTableCaptionElement.html">HTMLTableCaptionElement</A>, <A HREF="DOM__HTMLTableCellElement.html">HTMLTableCellElement</A>, <A HREF="DOM__HTMLTableColElement.html">HTMLTableColElement</A>, <A HREF="DOM__HTMLTableElement.html">HTMLTableElement</A>, <A HREF="DOM__HTMLTableRowElement.html">HTMLTableRowElement</A>, <A HREF="DOM__HTMLTableSectionElement.html">HTMLTableSectionElement</A>, <A HREF="DOM__HTMLTextAreaElement.html">HTMLTextAreaElement</A>, <A HREF="DOM__HTMLTitleElement.html">HTMLTitleElement</A>, <A HREF="DOM__HTMLUListElement.html">HTMLUListElement</A></TD></TR> <TR><TH><A HREF="full-list-DOM__Element.html">List of all Methods</A></TH></TR> </TABLE> </TD> <TD align="right"><TABLE BORDER="0"><TR><TD><small><A HREF="index-long.html">Annotated List</A></small></TD></TR> <TR><TD><small><A HREF="header-list.html">Files</A></small></TD></TR> <TR><TD><small><A HREF="all-globals.html">Globals</A></small></TD></TR> <TR><TD><small><A HREF="hier.html">Hierarchy</A></small></TD></TR> <TR><TD><small><A HREF="index.html">Index</A></small></TD></TR> </TABLE></TD></TR></TABLE> <h4>Public Methods</h4><ul><LI> <b><A HREF="#ref3">Element</A></b> () </LI> <LI> <b><A HREF="#ref4">Element</A></b> (const Node &other) </LI> <LI> <b><A HREF="#ref5">Element</A></b> (const Element &other) </LI> <LI>Element & <b><A HREF="#ref6">operator = </A></b> (const Node &other) </LI> <LI>Element & <b><A HREF="#ref7">operator = </A></b> (const Element &other) </LI> <LI> <b><A HREF="#ref8">~Element</A></b> () </LI> <LI>DOMString <b><A HREF="#ref9">tagName</A></b> () const </LI> <LI>DOMString <b><A HREF="#ref10">getAttribute</A></b> ( const DOMString &name ) </LI> <LI>void <b><A HREF="#ref11">setAttribute</A></b> ( const DOMString &name, const DOMString &value ) </LI> <LI>void <b><A HREF="#ref12">removeAttribute</A></b> ( const DOMString &name ) </LI> <LI>Attr <b><A HREF="#ref13">getAttributeNode</A></b> ( const DOMString &name ) </LI> <LI>Attr <b><A HREF="#ref14">setAttributeNode</A></b> ( const Attr &newAttr ) </LI> <LI>Attr <b><A HREF="#ref15">removeAttributeNode</A></b> ( const Attr &oldAttr ) </LI> <LI>NodeList <b><A HREF="#ref16">getElementsByTagName</A></b> ( const DOMString &name ) </LI> <LI>void <b><A HREF="#ref17">normalize</A></b> ( ) </LI> <LI>CSSStyleDeclaration <b><A HREF="#ref18">style</A></b> ( ) </LI> <LI>bool <b><A HREF="#ref19">isHTMLElement</A></b> () const </LI> </ul><h4>Protected Methods</h4><ul><LI> <b><A HREF="#ref20">Element</A></b> (ElementImpl *_impl) </LI> </ul><HR><H2><A NAME="longdesc">Detailed Description</A></H2><p> By far the vast majority of objects (apart from text) that authors encounter when traversing a document are <code> Element </code> nodes. Assume the following XML document: <elementExample id="demo"> <subelement1/> <subelement2><subsubelement/></subelement2> </elementExample> </p> <p> When represented using DOM, the top node is an <code> Element </code> node for "elementExample", which contains two child <code> Element </code> nodes, one for "subelement1" and one for "subelement2". "subelement1" contains no child nodes. </p> <p> Elements may have attributes associated with them; since the <code> Element </code> interface inherits from <code> Node </code> , the generic <code> Node </code> interface method <code> getAttributes </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. </p> <p> </p> <A NAME="Element"></A><A NAME="ref3"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>Element</strong> () <br></td><td align="right"><h3><strong>Element</strong></h3></td></tr></table><p></p><A NAME="Element"></A><A NAME="ref4"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>Element</strong> (const Node &other) <br></td><td align="right"><h3><strong>Element</strong></h3></td></tr></table><p></p><A NAME="Element"></A><A NAME="ref5"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>Element</strong> (const Element &other) <br></td><td align="right"><h3><strong>Element</strong></h3></td></tr></table><p></p><A NAME="operator%20=%20"></A><A NAME="ref6"></A><table width="100%"><tr bgcolor="#eeeeee"><td>Element & <strong>operator = </strong> (const Node &other) <br></td><td align="right"><h3><strong>operator = </strong></h3></td></tr></table><p></p><p>Reimplemented from <A HREF="DOM__Node.html#operator%20=%20">Node</A>.</p> <A NAME="operator%20=%20"></A><A NAME="ref7"></A><table width="100%"><tr bgcolor="#eeeeee"><td>Element & <strong>operator = </strong> (const Element &other) <br></td><td align="right"><h3><strong>operator = </strong></h3></td></tr></table><p></p><p>Reimplemented from <A HREF="DOM__Node.html#operator%20=%20">Node</A>.</p> <A NAME="~Element"></A><A NAME="ref8"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>~Element</strong> () <br></td><td align="right"><h3><strong>~Element</strong></h3></td></tr></table><p></p><A NAME="tagName"></A><A NAME="ref9"></A><table width="100%"><tr bgcolor="#eeeeee"><td>DOMString <strong>tagName</strong> () <br></td><td align="right"><h3><strong>tagName</strong></h3></td></tr></table><p> <small>[const]</small></p><p> The name of the element. For example, in: <elementExample id="demo"> ... </elementExample> , <code> tagName </code> has the value <code> "elementExample" </code> . Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the <code> tagName </code> of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document. </p> <p> </p> <A NAME="getAttribute"></A><A NAME="ref10"></A><table width="100%"><tr bgcolor="#eeeeee"><td>DOMString <strong>getAttribute</strong> ( const DOMString &name ) <br></td><td align="right"><h3><strong>getAttribute</strong></h3></td></tr></table><p></p><p> Retrieves an attribute value by name. </p> <p></p> <p></p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>name</i></TD><TD align="left" valign="top">The name of the attribute to retrieve. </TD></TR> </TABLE></P> <p><b>Returns</b>: The <code> Attr </code> value as a string, or the empty string if that attribute does not have a specified or default value. </p> <A NAME="setAttribute"></A><A NAME="ref11"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void <strong>setAttribute</strong> ( const DOMString &name, const DOMString &value ) <br></td><td align="right"><h3><strong>setAttribute</strong></h3></td></tr></table><p></p><p> Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value 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> setAttributeNode </code> to assign it as the value of an attribute. </p> <p></p> <p></p> <p></p> <p></p> <p> NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>name</i></TD><TD align="left" valign="top">The name of the attribute to create or alter. </TD></TR> <TR><TD align="left" valign="top"><i>value</i></TD><TD align="left" valign="top">Value to set in string form. </TD></TR> </TABLE></P> <p><b>Throws</b>: DOMException, INVALID_CHARACTER_ERR:, Raised, if, the, specified, name, contains, an, invalid, character.</p> <A NAME="removeAttribute"></A><A NAME="ref12"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void <strong>removeAttribute</strong> ( const DOMString &name ) <br></td><td align="right"><h3><strong>removeAttribute</strong></h3></td></tr></table><p></p><p> Removes an attribute by name. If the removed attribute has a default value it is immediately replaced. </p> <p></p> <p></p> <p></p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>name</i></TD><TD align="left" valign="top">The name of the attribute to remove. </TD></TR> </TABLE></P> <p><b>Throws</b>: DOMException, NO_MODIFICATION_ALLOWED_ERR:, Raised, if, this, node, is, readonly.</p> <A NAME="getAttributeNode"></A><A NAME="ref13"></A><table width="100%"><tr bgcolor="#eeeeee"><td>Attr <strong>getAttributeNode</strong> ( const DOMString &name ) <br></td><td align="right"><h3><strong>getAttributeNode</strong></h3></td></tr></table><p></p><p> Retrieves an <code> Attr </code> node by name. </p> <p></p> <p></p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>name</i></TD><TD align="left" valign="top">The name of the attribute to retrieve. </TD></TR> </TABLE></P> <p><b>Returns</b>: The <code> Attr </code> node with the specified attribute name or <code> null </code> if there is no such attribute. </p> <A NAME="setAttributeNode"></A><A NAME="ref14"></A><table width="100%"><tr bgcolor="#eeeeee"><td>Attr <strong>setAttributeNode</strong> ( const Attr &newAttr ) <br></td><td align="right"><h3><strong>setAttributeNode</strong></h3></td></tr></table><p></p><p> Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one. </p> <p></p> <p></p> <p></p> <p> NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p> <p> 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. </p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>newAttr</i></TD><TD align="left" valign="top">The <code> Attr </code> node to add to the attribute list. </TD></TR> </TABLE></P> <p><b>Returns</b>: If the <code> newAttr </code> attribute replaces an existing attribute with the same name, the previously existing <code> Attr </code> node is returned, otherwise <code> null </code> is returned. </p> <p><b>Throws</b>: DOMException, WRONG_DOCUMENT_ERR:, Raised, if, <code>, newAttr, </code>, was, created, from, a, different, document, than, the, one, that, created, the, element.</p> <A NAME="removeAttributeNode"></A><A NAME="ref15"></A><table width="100%"><tr bgcolor="#eeeeee"><td>Attr <strong>removeAttributeNode</strong> ( const Attr &oldAttr ) <br></td><td align="right"><h3><strong>removeAttributeNode</strong></h3></td></tr></table><p></p><p> Removes the specified attribute. </p> <p></p> <p></p> <p></p> <p> NOT_FOUND_ERR: Raised if <code> oldAttr </code> is not an attribute of the element. </p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>oldAttr</i></TD><TD align="left" valign="top">The <code> Attr </code> node to remove from the attribute list. If the removed <code> Attr </code> has a default value it is immediately replaced. </TD></TR> </TABLE></P> <p><b>Returns</b>: The <code> Attr </code> node that was removed. </p> <p><b>Throws</b>: DOMException, NO_MODIFICATION_ALLOWED_ERR:, Raised, if, this, node, is, readonly.</p> <A NAME="getElementsByTagName"></A><A NAME="ref16"></A><table width="100%"><tr bgcolor="#eeeeee"><td>NodeList <strong>getElementsByTagName</strong> ( const DOMString &name ) <br></td><td align="right"><h3><strong>getElementsByTagName</strong></h3></td></tr></table><p></p><p> Returns a <code> NodeList </code> of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the <code> Element </code> tree. </p> <p></p> <p></p> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>name</i></TD><TD align="left" valign="top">The name of the tag to match on. The special value "*" matches all tags. </TD></TR> </TABLE></P> <p><b>Returns</b>: A list of matching <code> Element </code> nodes. </p> <A NAME="normalize"></A><A NAME="ref17"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void <strong>normalize</strong> ( ) <br></td><td align="right"><h3><strong>normalize</strong></h3></td></tr></table><p></p><p> Puts all <code> Text </code> nodes in the full depth of the sub-tree underneath this <code> Element </code> into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates <code> Text </code> nodes, i.e., there are no adjacent <code> Text </code> nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used. </p> <p></p> <p> </p> <A NAME="style"></A><A NAME="ref18"></A><table width="100%"><tr bgcolor="#eeeeee"><td>CSSStyleDeclaration <strong>style</strong> ( ) <br></td><td align="right"><h3><strong>style</strong></h3></td></tr></table><p></p><p> Introduced in DOM Level 2 This method is from the CSSStyleDeclaration interface </p> <p> The style attribute </p> <A NAME="isHTMLElement"></A><A NAME="ref19"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool <strong>isHTMLElement</strong> () <br></td><td align="right"><h3><strong>isHTMLElement</strong></h3></td></tr></table><p> <small>[const]</small></p><p> not part of the DOM </p> <A NAME="Element"></A><A NAME="ref20"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>Element</strong> (ElementImpl *_impl) <br></td><td align="right"><h3><strong>Element</strong></h3></td></tr></table><p> <small>[protected]</small></p><HR> <table> <tr><td><small>Generated by: qateam on updates.mandrakesoft.com on Mon Dec 30 16:09:31 2002, using kdoc 2.0a53.</small></td></tr> </table> </BODY> </HTML>