Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:02

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMATTR_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMATTR_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 #include <xercesc/dom/DOMNode.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 class DOMElement;
0031 class DOMTypeInfo;
0032 
0033 /**
0034  * The <code>DOMAttr</code> class refers to an attribute of an XML element.
0035  *
0036  * Typically the allowable values for the
0037  * attribute are defined in a documenttype definition.
0038  * <p><code>DOMAttr</code> objects inherit the <code>DOMNode</code>  interface, but
0039  * since attributes are not actually child nodes of the elements they are associated with, the
0040  * DOM does not consider them part of the document  tree.  Thus, the
0041  * <code>DOMNode</code> attributes <code>parentNode</code>,
0042  * <code>previousSibling</code>, and <code>nextSibling</code> have a  null
0043  * value for <code>DOMAttr</code> objects. The DOM takes the  view that
0044  * attributes are properties of elements rather than having a  separate
0045  * identity from the elements they are associated with;  this should make it
0046  * more efficient to implement such features as default attributes associated
0047  * with all elements of a  given type.  Furthermore, attribute nodes
0048  * may not be immediate children of a <code>DOMDocumentFragment</code>. However,
0049  * they can be associated with <code>DOMElement</code> nodes contained within a
0050  * <code>DOMDocumentFragment</code>. In short, users of the DOM
0051  * need to be aware that  <code>DOMAttr</code> nodes have some things in  common
0052  * with other objects inheriting the <code>DOMNode</code> interface, but they
0053  * also are quite distinct.
0054  *
0055  * @since DOM Level 1
0056  */
0057 class CDOM_EXPORT DOMAttr: public DOMNode {
0058 protected:
0059     // -----------------------------------------------------------------------
0060     //  Hidden constructors
0061     // -----------------------------------------------------------------------
0062     /** @name Hidden constructors */
0063     //@{    
0064     DOMAttr() {}
0065     DOMAttr(const DOMAttr &other) : DOMNode(other) {}
0066     //@}
0067 
0068 private:    
0069     // -----------------------------------------------------------------------
0070     // Unimplemented constructors and operators
0071     // -----------------------------------------------------------------------
0072     /** @name Unimplemented operators */
0073     //@{
0074     DOMAttr & operator = (const DOMAttr &);
0075     //@}
0076 
0077 public:
0078     // -----------------------------------------------------------------------
0079     //  All constructors are hidden, just the destructor is available
0080     // -----------------------------------------------------------------------
0081     /** @name Destructor */
0082     //@{
0083     /**
0084      * Destructor
0085      *
0086      */
0087     virtual ~DOMAttr() {};
0088     //@}
0089 
0090     // -----------------------------------------------------------------------
0091     //  Virtual DOMAttr interface
0092     // -----------------------------------------------------------------------
0093     /** @name Functions introduced in DOM Level 1 */
0094     //@{
0095     // -----------------------------------------------------------------------
0096     //  Getter methods
0097     // -----------------------------------------------------------------------
0098     /**
0099      * Returns the name of this attribute.
0100      * @since DOM Level 1
0101      */
0102     virtual const XMLCh *       getName() const = 0;
0103 
0104     /**
0105      *
0106      * Returns true if the attribute received its value explicitly in the
0107      * XML document, or if a value was assigned programatically with
0108      * the setValue function.  Returns false if the attribute value
0109      * came from the default value declared in the document's DTD.
0110      * @since DOM Level 1
0111      */
0112     virtual bool            getSpecified() const = 0;
0113 
0114     /**
0115      * Returns the value of the attribute.
0116      *
0117      * The value of the attribute is returned as a string.
0118      * Character and general entity references are replaced with their values.
0119      * @since DOM Level 1
0120      */
0121     virtual const XMLCh *       getValue() const = 0;
0122 
0123     // -----------------------------------------------------------------------
0124     //  Setter methods
0125     // -----------------------------------------------------------------------
0126     /**
0127      * Sets the value of the attribute.  A text node with the unparsed contents
0128      * of the string will be created.
0129      *
0130      * @param value The value of the DOM attribute to be set
0131      * @since DOM Level 1
0132      */
0133     virtual void            setValue(const XMLCh *value) = 0;
0134     //@}
0135 
0136     /** @name Functions introduced in DOM Level 2. */
0137     //@{
0138     /**
0139      * The <code>DOMElement</code> node this attribute is attached to or
0140      * <code>null</code> if this attribute is not in use.
0141      *
0142      * @since DOM Level 2
0143      */
0144     virtual DOMElement     *getOwnerElement() const = 0;
0145     //@}
0146 
0147     /** @name Functions introduced in DOM Level 3. */
0148     //@{
0149     /**
0150      * Returns whether this attribute is known to be of type ID or not. 
0151      * When it is and its value is unique, the ownerElement of this attribute 
0152      * can be retrieved using getElementById on DOMDocument.
0153      *
0154      * @return <code>bool</code> stating if this <code>DOMAttr</code> is an ID
0155      * @since DOM level 3
0156      */
0157     virtual bool            isId() const = 0;
0158 
0159 
0160     /**
0161      * Returns the type information associated with this attribute.
0162      *
0163      * @return the <code>DOMTypeInfo</code> associated with this attribute
0164      * @since DOM level 3
0165      */
0166     virtual const DOMTypeInfo * getSchemaTypeInfo() const = 0;
0167 
0168     //@}
0169 
0170 };
0171 
0172 XERCES_CPP_NAMESPACE_END
0173 
0174 #endif
0175 
0176