source: NonGTP/Xerces/xerces/include/xercesc/dom/DOMAttr.hpp @ 358

Revision 358, 6.2 KB checked in by bittner, 19 years ago (diff)

xerces added

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