.TH "DOM::Attr" kde3 "11 Jun 2005" "Version Version 3.4.1" "khtml Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
DOM::Attr \- The \fC\fBAttr\fP\fP interface represents an attribute in an \fC\fBElement\fP\fP object.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <dom_element.h>\fP
.PP
Inherits \fBDOM::Node\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBAttr\fP (const \fBNode\fP &other)"
.br
.ti -1c
.RI "\fBAttr\fP (const \fBAttr\fP &other)"
.br
.ti -1c
.RI "\fBAttr\fP & \fBoperator=\fP (const \fBNode\fP &other)"
.br
.ti -1c
.RI "\fBAttr\fP & \fBoperator=\fP (const \fBAttr\fP &other)"
.br
.ti -1c
.RI "\fBDOMString\fP \fBname\fP () const "
.br
.ti -1c
.RI "bool \fBspecified\fP () const "
.br
.ti -1c
.RI "\fBDOMString\fP \fBvalue\fP () const "
.br
.ti -1c
.RI "void \fBsetValue\fP (const \fBDOMString\fP &)"
.br
.ti -1c
.RI "\fBElement\fP \fBownerElement\fP () const "
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBAttr\fP (AttrImpl *_impl)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBElement\fP"
.br
.ti -1c
.RI "class \fBDocument\fP"
.br
.ti -1c
.RI "class \fBDocumentImpl\fP"
.br
.ti -1c
.RI "class \fBHTMLDocument\fP"
.br
.ti -1c
.RI "class \fBElementImpl\fP"
.br
.ti -1c
.RI "class \fBNamedAttrMapImpl\fP"
.br
.ti -1c
.RI "class \fBAttrImpl\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
The \fC\fBAttr\fP\fP interface represents an attribute in an \fC\fBElement\fP\fP object. 

Typically the allowable values for the attribute are defined in a document type definition.
.PP
\fC\fBAttr\fP\fP objects inherit the \fC\fBNode\fP\fP interface, but since they are not actually child nodes of the element they describe, the \fBDOM\fP does not consider them part of the document tree. Thus, the \fC\fBNode\fP\fP attributes \fCparentNode\fP , \fCpreviousSibling\fP , and \fCnextSibling\fP have a null value for \fC\fBAttr\fP\fP objects. The \fBDOM\fP 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, \fC\fBAttr\fP\fP nodes may not be immediate children of a \fC\fBDocumentFragment\fP\fP . However, they can be associated with \fC\fBElement\fP\fP nodes contained within a \fC\fBDocumentFragment\fP\fP . In short, users and implementors of the \fBDOM\fP need to be aware that \fC\fBAttr\fP\fP nodes have some things in common with other objects inheriting the \fC\fBNode\fP\fP interface, but they also are quite distinct.
.PP
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 \fCnodeValue\fP attribute on the \fC\fBAttr\fP\fP instance can also be used to retrieve the string version of the attribute's value(s).
.PP
In XML, where the value of an attribute can contain entity references, the child nodes of the \fC\fBAttr\fP\fP node provide a representation in which entity references are not expanded. These child nodes may be either \fC\fBText\fP\fP or \fC\fBEntityReference\fP\fP nodes. Because the attribute type may be unknown, there are no tokenized attribute values. 
.PP
Definition at line 89 of file dom_element.h.
.SH "Member Function Documentation"
.PP 
.SS "\fBDOMString\fP Attr::name () const"
.PP
Returns the name of this attribute. 
.PP
Definition at line 68 of file dom_element.cpp.
.SS "bool Attr::specified () const"
.PP
If this attribute was explicitly given a value in the original document, this is \fCtrue\fP ; otherwise, it is \fCfalse\fP . 
.PP
Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then the \fCspecified\fP flag is automatically flipped to \fCtrue\fP . To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available with \fCspecified\fP set to \fCfalse\fP and the default value (if one exists).
.PP
In summary: 
.PD 0

.IP "\(bu" 2
If the attribute has an assigned value in the document then \fCspecified\fP is \fCtrue\fP , and the value is the assigned value.
.PP
.PD 0
.IP "\(bu" 2
If the attribute has no assigned value in the document and has a default value in the DTD, then \fCspecified\fP is \fCfalse\fP , and the value is the default value in the DTD.
.PP
.PD 0
.IP "\(bu" 2
If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document. 
.PP

.PP
Definition at line 74 of file dom_element.cpp.
.SS "\fBDOMString\fP Attr::value () const"
.PP
On retrieval, the value of the attribute is returned as a string. 
.PP
Character and general entity references are replaced with their values.
.PP
On setting, this creates a \fC\fBText\fP\fP node with the unparsed contents of the string. 
.PP
Definition at line 86 of file dom_element.cpp.
.SS "void Attr::setValue (const \fBDOMString\fP &)"
.PP
see value 
.PP
Definition at line 92 of file dom_element.cpp.
.SS "\fBElement\fP Attr::ownerElement () const"
.PP
Introduced in \fBDOM\fP Level 2. 
.PP
The \fBElement\fP node this attribute is attached to or null if this attribute is not in use. 
.PP
Definition at line 80 of file dom_element.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for khtml Library from the source code.
