\section{DOM::Attr Class Reference}
\label{classDOM_1_1Attr}\index{DOM::Attr@{DOM::Attr}}
The {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } interface represents an attribute in an {\tt  {\bf Element}{\rm (p.\,\pageref{classDOM_1_1Element})} } object.  


{\tt \#include $<$dom\_\-element.h$>$}

Inheritance diagram for DOM::Attr:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=52pt]{classDOM_1_1Attr__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for DOM::Attr:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=52pt]{classDOM_1_1Attr__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Attr} (const  {\bf Node} \&other)\label{classDOM_1_1Attr_a1}

\item 
{\bf Attr} (const  {\bf Attr} \&other)\label{classDOM_1_1Attr_a2}

\item 
{\bf Attr} \& {\bf operator=} (const  {\bf Node} \&other)\label{classDOM_1_1Attr_a3}

\item 
{\bf Attr} \& {\bf operator=} (const  {\bf Attr} \&other)\label{classDOM_1_1Attr_a4}

\item 
{\bf DOMString} {\bf name} () const 
\begin{CompactList}\small\item\em Returns the name of this attribute. \item\end{CompactList}\item 
bool {\bf specified} () const 
\begin{CompactList}\small\item\em If this attribute was explicitly given a value in the original document, this is {\tt  true } ; otherwise, it is {\tt  false } . \item\end{CompactList}\item 
{\bf DOMString} {\bf value} () const 
\begin{CompactList}\small\item\em On retrieval, the value of the attribute is returned as a string. \item\end{CompactList}\item 
void {\bf set\-Value} (const  {\bf DOMString} \&)
\begin{CompactList}\small\item\em see {\bf value}{\rm (p.\,\pageref{classDOM_1_1Attr_a8})} \item\end{CompactList}\item 
{\bf Element} {\bf owner\-Element} () const 
\begin{CompactList}\small\item\em Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf Attr} (Attr\-Impl $\ast$\_\-impl)\label{classDOM_1_1Attr_b0}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf Element}\label{classDOM_1_1Attr_n0}

\item 
class {\bf Document}\label{classDOM_1_1Attr_n1}

\item 
class {\bf Document\-Impl}\label{classDOM_1_1Attr_n2}

\item 
class {\bf HTMLDocument}\label{classDOM_1_1Attr_n3}

\item 
class {\bf Element\-Impl}\label{classDOM_1_1Attr_n4}

\item 
class {\bf Named\-Attr\-Map\-Impl}\label{classDOM_1_1Attr_n5}

\end{CompactItemize}


\subsection{Detailed Description}
The {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } interface represents an attribute in an {\tt  {\bf Element}{\rm (p.\,\pageref{classDOM_1_1Element})} } object. 

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

{\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } objects inherit the {\tt  {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} } interface, but since they are not actually child nodes of the element they describe, the {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} does not consider them part of the document tree. Thus, the {\tt  {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} } attributes {\tt  parent\-Node } , {\tt  previous\-Sibling } , and {\tt  next\-Sibling } have a null value for {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } objects. The {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} 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, {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } nodes may not be immediate children of a {\tt  {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})} } . However, they can be associated with {\tt  {\bf Element}{\rm (p.\,\pageref{classDOM_1_1Element})} } nodes contained within a {\tt  {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})} } . In short, users and implementors of the {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} need to be aware that {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } nodes have some things in common with other objects inheriting the {\tt  {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} } interface, but they also are quite distinct.

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 {\tt  node\-Value } attribute on the {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } instance can also be used to retrieve the string version of the attribute's value(s).

In XML, where the value of an attribute can contain entity references, the child nodes of the {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } node provide a representation in which entity references are not expanded. These child nodes may be either {\tt  {\bf Text}{\rm (p.\,\pageref{classDOM_1_1Text})} } or {\tt  {\bf Entity\-Reference}{\rm (p.\,\pageref{classDOM_1_1EntityReference})} } nodes. Because the attribute type may be unknown, there are no tokenized attribute values. 



Definition at line 88 of file dom\_\-element.h.

\subsection{Member Function Documentation}
\index{DOM::Attr@{DOM::Attr}!name@{name}}
\index{name@{name}!DOM::Attr@{DOM::Attr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DOMString} Attr::name () const}\label{classDOM_1_1Attr_a6}


Returns the name of this attribute. 



Definition at line 70 of file dom\_\-element.cpp.\index{DOM::Attr@{DOM::Attr}!specified@{specified}}
\index{specified@{specified}!DOM::Attr@{DOM::Attr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool Attr::specified () const}\label{classDOM_1_1Attr_a7}


If this attribute was explicitly given a value in the original document, this is {\tt  true } ; otherwise, it is {\tt  false } . 

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 {\tt  specified } flag is automatically flipped to {\tt  true } . 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 {\tt  specified } set to {\tt  false } and the default value (if one exists).

In summary:   If the attribute has an assigned value in the document then {\tt  specified } is {\tt  true } , and the value is the assigned value.

If the attribute has no assigned value in the document and has a default value in the DTD, then {\tt  specified } is {\tt  false } , and the value is the default value in the DTD.

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.

Definition at line 78 of file dom\_\-element.cpp.\index{DOM::Attr@{DOM::Attr}!value@{value}}
\index{value@{value}!DOM::Attr@{DOM::Attr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DOMString} Attr::value () const}\label{classDOM_1_1Attr_a8}


On retrieval, the value of the attribute is returned as a string. 

Character and general entity references are replaced with their values.

On setting, this creates a {\tt  {\bf Text}{\rm (p.\,\pageref{classDOM_1_1Text})} } node with the unparsed contents of the string. 

Definition at line 90 of file dom\_\-element.cpp.\index{DOM::Attr@{DOM::Attr}!setValue@{setValue}}
\index{setValue@{setValue}!DOM::Attr@{DOM::Attr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Attr::set\-Value (const {\bf DOMString} \&)}\label{classDOM_1_1Attr_a9}


see {\bf value}{\rm (p.\,\pageref{classDOM_1_1Attr_a8})} 



Definition at line 96 of file dom\_\-element.cpp.\index{DOM::Attr@{DOM::Attr}!ownerElement@{ownerElement}}
\index{ownerElement@{ownerElement}!DOM::Attr@{DOM::Attr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Element} Attr::owner\-Element () const}\label{classDOM_1_1Attr_a10}


Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. 

The {\bf Element}{\rm (p.\,\pageref{classDOM_1_1Element})} node this attribute is attached to or null if this attribute is not in use. 

Definition at line 84 of file dom\_\-element.cpp.

Referenced by DOM::Element::remove\-Attribute\-Node().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
dom\_\-element.h\item 
dom\_\-element.cpp\end{CompactItemize}
