source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/dom/DOMAttr.hpp @ 2674

Revision 2674, 6.2 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef DOMAttr_HEADER_GUARD_
2#define DOMAttr_HEADER_GUARD_
3
4/*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements.  See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21/*
22 * $Id: DOMAttr.hpp 568078 2007-08-21 11:43:25Z amassari $
23 */
24
25
26#include <xercesc/util/XercesDefs.hpp>
27#include <xercesc/dom/DOMNode.hpp>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31class DOMElement;
32class DOMTypeInfo;
33
34/**
35 * The <code>DOMAttr</code> class refers to an attribute of an XML element.
36 *
37 * Typically the allowable values for the
38 * attribute are defined in a documenttype definition.
39 * <p><code>DOMAttr</code> objects inherit the <code>DOMNode</code>  interface, but
40 * since attributes are not actually child nodes of the elements they are associated with, the
41 * DOM does not consider them part of the document  tree.  Thus, the
42 * <code>DOMNode</code> attributes <code>parentNode</code>,
43 * <code>previousSibling</code>, and <code>nextSibling</code> have a  null
44 * value for <code>DOMAttr</code> objects. The DOM takes the  view that
45 * attributes are properties of elements rather than having a  separate
46 * identity from the elements they are associated with;  this should make it
47 * more efficient to implement such features as default attributes associated
48 * with all elements of a  given type.  Furthermore, attribute nodes
49 * may not be immediate children of a <code>DOMDocumentFragment</code>. However,
50 * they can be associated with <code>DOMElement</code> nodes contained within a
51 * <code>DOMDocumentFragment</code>. In short, users of the DOM
52 * need to be aware that  <code>DOMAttr</code> nodes have some things in  common
53 * with other objects inheriting the <code>DOMNode</code> interface, but they
54 * also are quite distinct.
55 *
56 * @since DOM Level 1
57 */
58class CDOM_EXPORT DOMAttr: public DOMNode {
59protected:
60    // -----------------------------------------------------------------------
61    //  Hidden constructors
62    // -----------------------------------------------------------------------
63    /** @name Hidden constructors */
64    //@{   
65    DOMAttr() {}
66    DOMAttr(const DOMAttr &other) : DOMNode(other) {}
67    //@}
68
69private:   
70    // -----------------------------------------------------------------------
71    // Unimplemented constructors and operators
72    // -----------------------------------------------------------------------
73    /** @name Unimplemented operators */
74    //@{
75    DOMAttr & operator = (const DOMAttr &);
76    //@}
77
78public:
79    // -----------------------------------------------------------------------
80    //  All constructors are hidden, just the destructor is available
81    // -----------------------------------------------------------------------
82    /** @name Destructor */
83    //@{
84    /**
85     * Destructor
86     *
87     */
88    virtual ~DOMAttr() {};
89    //@}
90
91    // -----------------------------------------------------------------------
92    //  Virtual DOMAttr interface
93    // -----------------------------------------------------------------------
94    /** @name Functions introduced in DOM Level 1 */
95    //@{
96    // -----------------------------------------------------------------------
97    //  Getter methods
98    // -----------------------------------------------------------------------
99    /**
100     * Returns the name of this attribute.
101     * @since DOM Level 1
102     */
103    virtual const XMLCh *       getName() const = 0;
104
105    /**
106     *
107     * Returns true if the attribute received its value explicitly in the
108     * XML document, or if a value was assigned programatically with
109     * the setValue function.  Returns false if the attribute value
110     * came from the default value declared in the document's DTD.
111     * @since DOM Level 1
112     */
113    virtual bool            getSpecified() const = 0;
114
115    /**
116     * Returns the value of the attribute.
117     *
118     * The value of the attribute is returned as a string.
119     * Character and general entity references are replaced with their values.
120     * @since DOM Level 1
121     */
122    virtual const XMLCh *       getValue() const = 0;
123
124    // -----------------------------------------------------------------------
125    //  Setter methods
126    // -----------------------------------------------------------------------
127    /**
128     * Sets the value of the attribute.  A text node with the unparsed contents
129     * of the string will be created.
130     *
131     * @param value The value of the DOM attribute to be set
132     * @since DOM Level 1
133     */
134    virtual void            setValue(const XMLCh *value) = 0;
135    //@}
136
137    /** @name Functions introduced in DOM Level 2. */
138    //@{
139    /**
140     * The <code>DOMElement</code> node this attribute is attached to or
141     * <code>null</code> if this attribute is not in use.
142     *
143     * @since DOM Level 2
144     */
145    virtual DOMElement     *getOwnerElement() const = 0;
146    //@}
147
148    /** @name Functions introduced in DOM Level 3. */
149    //@{
150    /**
151     * Returns whether this attribute is known to be of type ID or not.
152     * When it is and its value is unique, the ownerElement of this attribute
153     * can be retrieved using getElementById on Document.
154     *
155     * <p><b>"Experimental - subject to change"</b></p>
156     *
157     * @return <code>bool</code> stating if this <code>DOMAttr</code> is an ID
158     * @since DOM level 3
159     */
160    virtual bool            isId() const = 0;
161
162
163    /**
164     * Returns the type information associated with this attribute.
165     *
166     * <p><b>"Experimental - subject to change"</b></p>
167     *
168     * @return the <code>DOMTypeInfo</code> associated with this attribute
169     * @since DOM level 3
170     */
171    virtual const DOMTypeInfo * getTypeInfo() const = 0;
172
173    //@}
174
175};
176
177XERCES_CPP_NAMESPACE_END
178
179#endif
180
181
Note: See TracBrowser for help on using the repository browser.