[188] | 1 | #ifndef DOMAttr_HEADER_GUARD_
|
---|
| 2 | #define DOMAttr_HEADER_GUARD_
|
---|
| 3 |
|
---|
| 4 | /*
|
---|
| 5 | * The Apache Software License, Version 1.1
|
---|
| 6 | *
|
---|
| 7 | * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
|
---|
| 8 | * reserved.
|
---|
| 9 | *
|
---|
| 10 | * Redistribution and use in source and binary forms, with or without
|
---|
| 11 | * modification, are permitted provided that the following conditions
|
---|
| 12 | * are met:
|
---|
| 13 | *
|
---|
| 14 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer.
|
---|
| 16 | *
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 18 | * notice, this list of conditions and the following disclaimer in
|
---|
| 19 | * the documentation and/or other materials provided with the
|
---|
| 20 | * distribution.
|
---|
| 21 | *
|
---|
| 22 | * 3. The end-user documentation included with the redistribution,
|
---|
| 23 | * if any, must include the following acknowledgment:
|
---|
| 24 | * "This product includes software developed by the
|
---|
| 25 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 26 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 27 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 28 | *
|
---|
| 29 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 30 | * not be used to endorse or promote products derived from this
|
---|
| 31 | * software without prior written permission. For written
|
---|
| 32 | * permission, please contact apache\@apache.org.
|
---|
| 33 | *
|
---|
| 34 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 35 | * nor may "Apache" appear in their name, without prior written
|
---|
| 36 | * permission of the Apache Software Foundation.
|
---|
| 37 | *
|
---|
| 38 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 39 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 40 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 41 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 42 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 43 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 44 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 45 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 46 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 48 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 49 | * SUCH DAMAGE.
|
---|
| 50 | * ====================================================================
|
---|
| 51 | *
|
---|
| 52 | * This software consists of voluntary contributions made by many
|
---|
| 53 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 54 | * originally based on software copyright (c) 2001, International
|
---|
| 55 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 56 | * on the Apache Software Foundation, please see
|
---|
| 57 | * <http://www.apache.org/>.
|
---|
| 58 | */
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | * $Id: DOMAttr.hpp,v 1.8 2003/03/07 19:58:58 tng Exp $
|
---|
| 62 | */
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | #include <xercesc/util/XercesDefs.hpp>
|
---|
| 66 | #include "DOMNode.hpp"
|
---|
| 67 |
|
---|
| 68 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 69 |
|
---|
| 70 | class DOMElement;
|
---|
| 71 | class DOMTypeInfo;
|
---|
| 72 |
|
---|
| 73 | /**
|
---|
| 74 | * The <code>DOMAttr</code> class refers to an attribute of an XML element.
|
---|
| 75 | *
|
---|
| 76 | * Typically the allowable values for the
|
---|
| 77 | * attribute are defined in a documenttype definition.
|
---|
| 78 | * <p><code>DOMAttr</code> objects inherit the <code>DOMNode</code> interface, but
|
---|
| 79 | * since attributes are not actually child nodes of the elements they are associated with, the
|
---|
| 80 | * DOM does not consider them part of the document tree. Thus, the
|
---|
| 81 | * <code>DOMNode</code> attributes <code>parentNode</code>,
|
---|
| 82 | * <code>previousSibling</code>, and <code>nextSibling</code> have a null
|
---|
| 83 | * value for <code>DOMAttr</code> objects. The DOM takes the view that
|
---|
| 84 | * attributes are properties of elements rather than having a separate
|
---|
| 85 | * identity from the elements they are associated with; this should make it
|
---|
| 86 | * more efficient to implement such features as default attributes associated
|
---|
| 87 | * with all elements of a given type. Furthermore, attribute nodes
|
---|
| 88 | * may not be immediate children of a <code>DOMDocumentFragment</code>. However,
|
---|
| 89 | * they can be associated with <code>DOMElement</code> nodes contained within a
|
---|
| 90 | * <code>DOMDocumentFragment</code>. In short, users of the DOM
|
---|
| 91 | * need to be aware that <code>DOMAttr</code> nodes have some things in common
|
---|
| 92 | * with other objects inheriting the <code>DOMNode</code> interface, but they
|
---|
| 93 | * also are quite distinct.
|
---|
| 94 | *
|
---|
| 95 | * @since DOM Level 1
|
---|
| 96 | */
|
---|
| 97 | class CDOM_EXPORT DOMAttr: public DOMNode {
|
---|
| 98 | protected:
|
---|
| 99 | // -----------------------------------------------------------------------
|
---|
| 100 | // Hidden constructors
|
---|
| 101 | // -----------------------------------------------------------------------
|
---|
| 102 | /** @name Hidden constructors */
|
---|
| 103 | //@{
|
---|
| 104 | DOMAttr() {};
|
---|
| 105 | //@}
|
---|
| 106 |
|
---|
| 107 | private:
|
---|
| 108 | // -----------------------------------------------------------------------
|
---|
| 109 | // Unimplemented constructors and operators
|
---|
| 110 | // -----------------------------------------------------------------------
|
---|
| 111 | /** @name Unimplemented constructors and operators */
|
---|
| 112 | //@{
|
---|
| 113 | DOMAttr(const DOMAttr &);
|
---|
| 114 | DOMAttr & operator = (const DOMAttr &);
|
---|
| 115 | //@}
|
---|
| 116 |
|
---|
| 117 | public:
|
---|
| 118 | // -----------------------------------------------------------------------
|
---|
| 119 | // All constructors are hidden, just the destructor is available
|
---|
| 120 | // -----------------------------------------------------------------------
|
---|
| 121 | /** @name Destructor */
|
---|
| 122 | //@{
|
---|
| 123 | /**
|
---|
| 124 | * Destructor
|
---|
| 125 | *
|
---|
| 126 | */
|
---|
| 127 | virtual ~DOMAttr() {};
|
---|
| 128 | //@}
|
---|
| 129 |
|
---|
| 130 | // -----------------------------------------------------------------------
|
---|
| 131 | // Virtual DOMAttr interface
|
---|
| 132 | // -----------------------------------------------------------------------
|
---|
| 133 | /** @name Functions introduced in DOM Level 1 */
|
---|
| 134 | //@{
|
---|
| 135 | // -----------------------------------------------------------------------
|
---|
| 136 | // Getter methods
|
---|
| 137 | // -----------------------------------------------------------------------
|
---|
| 138 | /**
|
---|
| 139 | * Returns the name of this attribute.
|
---|
| 140 | * @since DOM Level 1
|
---|
| 141 | */
|
---|
| 142 | virtual const XMLCh * getName() const = 0;
|
---|
| 143 |
|
---|
| 144 | /**
|
---|
| 145 | *
|
---|
| 146 | * Returns true if the attribute received its value explicitly in the
|
---|
| 147 | * XML document, or if a value was assigned programatically with
|
---|
| 148 | * the setValue function. Returns false if the attribute value
|
---|
| 149 | * came from the default value declared in the document's DTD.
|
---|
| 150 | * @since DOM Level 1
|
---|
| 151 | */
|
---|
| 152 | virtual bool getSpecified() const = 0;
|
---|
| 153 |
|
---|
| 154 | /**
|
---|
| 155 | * Returns the value of the attribute.
|
---|
| 156 | *
|
---|
| 157 | * The value of the attribute is returned as a string.
|
---|
| 158 | * Character and general entity references are replaced with their values.
|
---|
| 159 | * @since DOM Level 1
|
---|
| 160 | */
|
---|
| 161 | virtual const XMLCh * getValue() const = 0;
|
---|
| 162 |
|
---|
| 163 | // -----------------------------------------------------------------------
|
---|
| 164 | // Setter methods
|
---|
| 165 | // -----------------------------------------------------------------------
|
---|
| 166 | /**
|
---|
| 167 | * Sets the value of the attribute. A text node with the unparsed contents
|
---|
| 168 | * of the string will be created.
|
---|
| 169 | *
|
---|
| 170 | * @param value The value of the DOM attribute to be set
|
---|
| 171 | * @since DOM Level 1
|
---|
| 172 | */
|
---|
| 173 | virtual void setValue(const XMLCh *value) = 0;
|
---|
| 174 | //@}
|
---|
| 175 |
|
---|
| 176 | /** @name Functions introduced in DOM Level 2. */
|
---|
| 177 | //@{
|
---|
| 178 | /**
|
---|
| 179 | * The <code>DOMElement</code> node this attribute is attached to or
|
---|
| 180 | * <code>null</code> if this attribute is not in use.
|
---|
| 181 | *
|
---|
| 182 | * @since DOM Level 2
|
---|
| 183 | */
|
---|
| 184 | virtual DOMElement *getOwnerElement() const = 0;
|
---|
| 185 | //@}
|
---|
| 186 |
|
---|
| 187 | /** @name Functions introduced in DOM Level 3. */
|
---|
| 188 | //@{
|
---|
| 189 | /**
|
---|
| 190 | * Returns whether this attribute is known to be of type ID or not.
|
---|
| 191 | * When it is and its value is unique, the ownerElement of this attribute
|
---|
| 192 | * can be retrieved using getElementById on Document.
|
---|
| 193 | *
|
---|
| 194 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 195 | *
|
---|
| 196 | * @return <code>bool</code> stating if this <code>DOMAttr</code> is an ID
|
---|
| 197 | * @since DOM level 3
|
---|
| 198 | */
|
---|
| 199 | virtual bool isId() const = 0;
|
---|
| 200 |
|
---|
| 201 |
|
---|
| 202 | /**
|
---|
| 203 | * Returns the type information associated with this attribute.
|
---|
| 204 | *
|
---|
| 205 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 206 | *
|
---|
| 207 | * @return the <code>DOMTypeInfo</code> associated with this attribute
|
---|
| 208 | * @since DOM level 3
|
---|
| 209 | */
|
---|
| 210 | virtual const DOMTypeInfo * getTypeInfo() const = 0;
|
---|
| 211 |
|
---|
| 212 | //@}
|
---|
| 213 |
|
---|
| 214 | };
|
---|
| 215 |
|
---|
| 216 | XERCES_CPP_NAMESPACE_END
|
---|
| 217 |
|
---|
| 218 | #endif
|
---|
| 219 |
|
---|
| 220 |
|
---|