Modules Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members Related Pages
org::w3c::dom::Element Class Reference#include <Element.h>
Inheritance diagram for org::w3c::dom::Element:
List of all members.
Detailed Description
The Element interface represents an element in an HTML or XML document.
Elements may have attributes associated with them; since the Element interface inherits from Node , the generic Node interface attribute attributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr 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 >Note: In DOM Level 2, the method normalize is inherited from the Node interface where it was moved.
See also the Document acdk::lang::Object Model (DOM) Level 3 Core Specification.
- Author:
- Roger Rene Kommer
- Version:
- Revision
- 1.12
- Date:
- Date
- 2005/02/05 10:45:37
Member Function Documentation
|
dom4j like extension if value == Nil the attribute will be removed if attribute already exists it will be replaced
- Returns:
- this
|
virtual RElement org::w3c::dom::Element::addCDATA |
( |
IN(RString) |
cdata |
) |
[virtual] |
|
|
dom4j like extension add a new element as child
|
virtual RElement org::w3c::dom::Element::addComment |
( |
IN(RString) |
comment |
) |
[virtual] |
|
|
dom4j like extension add a new element as child
- Returns:
- this
|
virtual RElement org::w3c::dom::Element::addText |
( |
IN(RString) |
text |
) |
[virtual] |
|
|
dom4j like extension add a new element as child
|
virtual RAttr org::w3c::dom::Element::attribute |
( |
int |
idx |
) |
[pure virtual] |
|
virtual int org::w3c::dom::Element::attributeCount |
( |
|
) |
[pure virtual] |
|
virtual RString org::w3c::dom::Element::getAttribute |
( |
IN(RString) |
name |
) |
[pure virtual] |
|
virtual RAttr org::w3c::dom::Element::getAttributeNode |
( |
IN(RString) |
name |
) |
[pure virtual] |
|
|
Retrieves an attribute node by name.
To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS method. - Parameters:
-
name | The name (nodeName ) of the attribute to retrieve. |
- Returns:
- The
Attr node with the specified name ( nodeName ) or null if there is no such attribute.
Implemented in acdk::xml::dom::XMLElement, and acdk::xml::libxmldom::LibXMLElement. |
virtual RNodeList org::w3c::dom::Element::getElementsByTagName |
( |
IN(RString) |
name |
) |
[pure virtual] |
|
virtual RString org::w3c::dom::Element::getTagName |
( |
|
) |
[pure virtual] |
|
|
The name of the element.
If Node.localName is different from null , this attribute is a qualified name. For example, in: <elementExample id=demo> ...
</elementExample> , tagName has the value elementExample . Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the tagName of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.
Implemented in acdk::xml::dom::XMLElement, and acdk::xml::libxmldom::LibXMLElement.
|
virtual void org::w3c::dom::Element::normalize |
( |
|
) |
[pure virtual] |
|
virtual void org::w3c::dom::Element::removeAttribute |
( |
IN(RString) |
name |
) |
throw ( RDOMException ) [pure virtual] |
|
|
Removes an attribute by name.
If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
If no attribute with this name is found, this method has no effect.
To remove an attribute by local name and namespace URI, use the removeAttributeNS method. - Parameters:
-
name | The name of the attribute to remove. |
- Exceptions:
-
DOMException | NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
Implemented in acdk::xml::dom::XMLElement, and acdk::xml::libxmldom::LibXMLElement. |
virtual RAttr org::w3c::dom::Element::removeAttributeNode |
( |
IN(RAttr) |
oldAttr |
) |
throw ( RDOMException ) [pure virtual] |
|
|
Removes the specified attribute node.
If a default value for the removed Attr node is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date. - Parameters:
-
oldAttr | The Attr node to remove from the attribute list. |
- Returns:
- The
Attr node that was removed.
- Exceptions:
-
DOMException | NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element. |
Implemented in acdk::xml::dom::XMLElement. |
|
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 Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute.
To set an attribute with a qualified name and namespace URI, use the setAttributeNS method. - Parameters:
-
name | The name of the attribute to create or alter. |
value | Value to set in string form. |
- Exceptions:
-
DOMException | INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
Implemented in acdk::xml::dom::XMLElement, and acdk::xml::libxmldom::LibXMLElement. |
virtual RAttr org::w3c::dom::Element::setAttributeNode |
( |
IN(RAttr) |
newAttr |
) |
throw ( RDOMException ) [pure virtual] |
|
|
Adds a new attribute node.
If an attribute with that name ( nodeName ) is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.
To add a new attribute node with a qualified name and namespace URI, use the setAttributeNodeNS method. - Parameters:
-
newAttr | The Attr node to add to the attribute list. |
- Returns:
- If the
newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise null is returned.
- Exceptions:
-
DOMException | WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements. |
Implemented in acdk::xml::dom::XMLElement. |
|