| API Docs for SAX and DOM |

Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

# DOMAttr Class Reference

The `DOMAttr` class refers to an attribute of an XML element. More...

Inheritance diagram for DOMAttr:

[legend]
List of all members.

## Public Member Functions

Destructor
virtual | ~DOMAttr ()
| Destructor.
Functions introduced in DOM Level 1
virtual const XMLCh * | getName () const =0
| Returns the name of this attribute.
virtual bool | getSpecified () const =0
| Returns true if the attribute received its value explicitly in the XML document, or if a value was assigned programatically with the setValue function.
virtual const XMLCh * | getValue () const =0
| Returns the value of the attribute.
virtual void | setValue (const XMLCh *value)=0
| Sets the value of the attribute.
Functions introduced in DOM Level 2.
virtual DOMElement * | getOwnerElement () const =0
| The `DOMElement` node this attribute is attached to or `null` if this attribute is not in use.
Functions introduced in DOM Level 3.
virtual bool | isId () const =0
| Returns whether this attribute is known to be of type ID or not.
virtual const DOMTypeInfo * | getTypeInfo () const =0
| Returns the type information associated with this attribute.

## Protected Member Functions

Hidden constructors
| DOMAttr ()
| DOMAttr (const DOMAttr &other)

## Detailed Description

The `DOMAttr` class refers to an attribute of an XML element.

Typically the allowable values for the attribute are defined in a documenttype definition.

`DOMAttr` objects inherit the `DOMNode` interface, but since attributes are not actually child nodes of the elements they are associated with, the DOM does not consider them part of the document tree. Thus, the `DOMNode` attributes `parentNode`, `previousSibling`, and `nextSibling` have a null value for `DOMAttr` 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, attribute nodes may not be immediate children of a `DOMDocumentFragment`. However, they can be associated with `DOMElement` nodes contained within a `DOMDocumentFragment`. In short, users of the DOM need to be aware that `DOMAttr` nodes have some things in common with other objects inheriting the `DOMNode` interface, but they also are quite distinct.

Since:
  DOM Level 1

## Constructor & Destructor Documentation

DOMAttr::DOMAttr | ( |  | ) | `[protected]`

DOMAttr::DOMAttr | ( | const DOMAttr & | other | ) | `[protected]`

virtual DOMAttr::~DOMAttr | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

virtual const XMLCh* DOMAttr::getName | ( |  | ) | const`[pure virtual]`

Returns the name of this attribute.

Since:
  DOM Level 1

virtual DOMElement* DOMAttr::getOwnerElement | ( |  | ) | const`[pure virtual]`

The `DOMElement` node this attribute is attached to or `null` if this attribute is not in use.

Since:
  DOM Level 2

virtual bool DOMAttr::getSpecified | ( |  | ) | const`[pure virtual]`

Returns true if the attribute received its value explicitly in the XML document, or if a value was assigned programatically with the setValue function.

Returns false if the attribute value came from the default value declared in the document's DTD.

Since:
  DOM Level 1

virtual const DOMTypeInfo* DOMAttr::getTypeInfo | ( |  | ) | const`[pure virtual]`

Returns the type information associated with this attribute.

"Experimental - subject to change"

Returns:
  the `DOMTypeInfo` associated with this attribute

Since:
  DOM level 3

virtual const XMLCh* DOMAttr::getValue | ( |  | ) | const`[pure virtual]`

Returns the value of the attribute.

The value of the attribute is returned as a string. Character and general entity references are replaced with their values.

Since:
  DOM Level 1

virtual bool DOMAttr::isId | ( |  | ) | const`[pure virtual]`

Returns whether this attribute is known to be of type ID or not.

When it is and its value is unique, the ownerElement of this attribute can be retrieved using getElementById on Document.

"Experimental - subject to change"

Returns:
  `bool` stating if this `DOMAttr` is an ID

Since:
  DOM level 3

virtual void DOMAttr::setValue | ( | const XMLCh * | value | ) | `[pure virtual]`

Sets the value of the attribute.

A text node with the unparsed contents of the string will be created.

Parameters:

  | value | The value of the DOM attribute to be set

Since:
  DOM Level 1

The documentation for this class was generated from the following file:

- DOMAttr.hpp

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.