| API Docs for SAX and DOM |

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XMLAttr.hpp

Go to the documentation of this file.

    00001 /*
    00002  * The Apache Software License, Version 1.1
    00003  *
    00004  * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    00005  * reserved.
    00006  *
    00007  * Redistribution and use in source and binary forms, with or without
    00008  * modification, are permitted provided that the following conditions
    00009  * are met:
    00010  *
    00011  * 1. Redistributions of source code must retain the above copyright
    00012  *    notice, this list of conditions and the following disclaimer.
    00013  *
    00014  * 2. Redistributions in binary form must reproduce the above copyright
    00015  *    notice, this list of conditions and the following disclaimer in
    00016  *    the documentation and/or other materials provided with the
    00017  *    distribution.
    00018  *
    00019  * 3. The end-user documentation included with the redistribution,
    00020  *    if any, must include the following acknowledgment:
    00021  *       "This product includes software developed by the
    00022  *        Apache Software Foundation (http://www.apache.org/)."
    00023  *    Alternately, this acknowledgment may appear in the software itself,
    00024  *    if and wherever such third-party acknowledgments normally appear.
    00025  *
    00026  * 4. The names "Xerces" and "Apache Software Foundation" must
    00027  *    not be used to endorse or promote products derived from this
    00028  *    software without prior written permission. For written
    00029  *    permission, please contact apache\@apache.org.
    00030  *
    00031  * 5. Products derived from this software may not be called "Apache",
    00032  *    nor may "Apache" appear in their name, without prior written
    00033  *    permission of the Apache Software Foundation.
    00034  *
    00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00046  * SUCH DAMAGE.
    00047  * ====================================================================
    00048  *
    00049  * This software consists of voluntary contributions made by many
    00050  * individuals on behalf of the Apache Software Foundation, and was
    00051  * originally based on software copyright (c) 1999, International
    00052  * Business Machines, Inc., http://www.ibm.com .  For more information
    00053  * on the Apache Software Foundation, please see
    00054  * <http://www.apache.org/>.
    00055  */
    00056
    00057 /*
    00058  * $Log: XMLAttr.hpp,v $
    00059  * Revision 1.2  2002/02/20 18:17:01  tng
    00060  * [Bug 5977] Warnings on generating apiDocs.
    00061  *
    00062  * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
    00063  * sane_include
    00064  *
    00065  * Revision 1.9  2001/11/02 14:21:18  knoaman
    00066  * Add support for identity constraints.
    00067  *
    00068  * Revision 1.8  2001/05/11 13:25:31  tng
    00069  * Copyright update.
    00070  *
    00071  * Revision 1.7  2001/02/27 18:33:55  tng
    00072  * Schema: Use QName in XMLAttr.
    00073  *
    00074  * Revision 1.6  2000/04/10 22:42:53  roddey
    00075  * Extended the buffer reuse to the QName field, to further increase
    00076  * performance of attribute heavy applications.
    00077  *
    00078  * Revision 1.5  2000/03/02 19:54:24  roddey
    00079  * This checkin includes many changes done while waiting for the
    00080  * 1.1.0 code to be finished. I can't list them all here, but a list is
    00081  * available elsewhere.
    00082  *
    00083  * Revision 1.4  2000/02/24 20:00:22  abagchi
    00084  * Swat for removing Log from API docs
    00085  *
    00086  * Revision 1.3  2000/02/15 01:21:30  roddey
    00087  * Some initial documentation improvements. More to come...
    00088  *
    00089  * Revision 1.2  2000/02/06 07:47:47  rahulj
    00090  * Year 2K copyright swat.
    00091  *
    00092  * Revision 1.1.1.1  1999/11/09 01:08:28  twl
    00093  * Initial checkin
    00094  *
    00095  * Revision 1.2  1999/11/08 20:44:35  rahul
    00096  * Swat for adding in Product name and CVS comment log variable.
    00097  *
    00098  */
    00099
    00100 #if !defined(XMLATTR_HPP)
    00101 #define XMLATTR_HPP
    00102
    00103 #include <xercesc/util/XMLString.hpp>
    00104 #include <xercesc/util/QName.hpp>
    00105 #include <xercesc/framework/XMLAttDef.hpp>
    00106
    00107
    00129 class  XMLAttr
    00130 {
    00131 public:
    00132     // -----------------------------------------------------------------------
    00133     //  Constructors and Destructor
    00134     // -----------------------------------------------------------------------
    00137
    00143     XMLAttr();
    00144
    00171     XMLAttr
    00172     (
    00173         const   unsigned int        uriId
    00174         , const XMLCh* const        attrName
    00175         , const XMLCh* const        attrPrefix
    00176         , const XMLCh* const        attrValue
    00177         , const XMLAttDef::AttTypes type = XMLAttDef::CData
    00178         , const bool                specified = true
    00179     );
    00181
    00184     ~XMLAttr();
    00186
    00187
    00188     // -----------------------------------------------------------------------
    00189     //  Getter methods
    00190     // -----------------------------------------------------------------------
    00191
    00194
    00198     QName* getAttName() const;
    00199
    00204     const XMLCh* getName() const;
    00205
    00210     const XMLCh* getPrefix() const;
    00211
    00217     const XMLCh* getQName() const;
    00218
    00223     bool getSpecified() const;
    00224
    00229     XMLAttDef::AttTypes getType() const;
    00230
    00236     const XMLCh* getValue() const;
    00237
    00242     unsigned int getURIId() const;
    00243
    00245
    00246
    00247     // -----------------------------------------------------------------------
    00248     //  Setter methods
    00249     // -----------------------------------------------------------------------
    00250
    00253
    00278     void set
    00279     (
    00280         const   unsigned int        uriId
    00281         , const XMLCh* const        attrName
    00282         , const XMLCh* const        attrPrefix
    00283         , const XMLCh* const        attrValue
    00284         , const XMLAttDef::AttTypes type = XMLAttDef::CData
    00285     );
    00286
    00301     void setName
    00302     (
    00303         const   unsigned int        uriId
    00304         , const XMLCh* const        attrName
    00305         , const XMLCh* const        attrPrefix
    00306     );
    00307
    00315     void setSpecified(const bool newValue);
    00316
    00325     void setType(const XMLAttDef::AttTypes newType);
    00326
    00334     void setValue(const XMLCh* const newValue);
    00335
    00343     void setURIId(const unsigned int uriId);
    00344
    00346
    00347
    00348
    00349 private :
    00350     // -----------------------------------------------------------------------
    00351     //  Unimplemented constructors and operators
    00352     // -----------------------------------------------------------------------
    00353     XMLAttr(const XMLAttr&);
    00354     XMLAttr& operator=(const XMLAttr&);
    00355
    00356
    00357     // -----------------------------------------------------------------------
    00358     //  Private, helper methods
    00359     // -----------------------------------------------------------------------
    00360     void cleanUp();
    00361
    00362
    00363     // -----------------------------------------------------------------------
    00364     //  Private instance variables
    00365     //
    00366     //  fAttName
    00367     //      The Attribute Name;
    00368     //
    00369     //  fSpecified
    00370     //      True if this attribute appeared in the element; else, false if
    00371     //      it was defaulted from an AttDef.
    00372     //
    00373     //  fType
    00374     //      The attribute type enum value for this attribute. Indicates what
    00375     //      type of attribute it was.
    00376     //
    00377     //  fValue
    00378     //  fValueBufSz
    00379     //      The attribute value that was given in the attribute instance, and
    00380     //      its current buffer size (minus one, where the null is.)
    00381     //
    00382     // -----------------------------------------------------------------------
    00383     bool                fSpecified;
    00384     XMLAttDef::AttTypes fType;
    00385     XMLCh*              fValue;
    00386     unsigned int        fValueBufSz;
    00387     QName*              fAttName;
    00388 };
    00389
    00390 // ---------------------------------------------------------------------------
    00391 //  XMLAttr: Constructors and Destructor
    00392 // ---------------------------------------------------------------------------
    00393 inline XMLAttr::~XMLAttr()
    00394 {
    00395     cleanUp();
    00396 }
    00397
    00398
    00399 // ---------------------------------------------------------------------------
    00400 //  XMLAttr: Getter methods
    00401 // ---------------------------------------------------------------------------
    00402 inline QName* XMLAttr::getAttName() const
    00403 {
    00404     return fAttName;
    00405 }
    00406
    00407 inline const XMLCh* XMLAttr::getName() const
    00408 {
    00409     return fAttName->getLocalPart();
    00410 }
    00411
    00412 inline const XMLCh* XMLAttr::getPrefix() const
    00413 {
    00414     return fAttName->getPrefix();
    00415 }
    00416
    00417 inline bool XMLAttr::getSpecified() const
    00418 {
    00419     return fSpecified;
    00420 }
    00421
    00422 inline XMLAttDef::AttTypes XMLAttr::getType() const
    00423 {
    00424     return fType;
    00425 }
    00426
    00427 inline const XMLCh* XMLAttr::getValue() const
    00428 {
    00429     return fValue;
    00430 }
    00431
    00432 inline unsigned int XMLAttr::getURIId() const
    00433 {
    00434     return fAttName->getURI();
    00435 }
    00436
    00437
    00438 // ---------------------------------------------------------------------------
    00439 //  XMLAttr: Setter methods
    00440 // ---------------------------------------------------------------------------
    00441 inline void XMLAttr::set(const  unsigned int        uriId
    00442                         , const XMLCh* const        attrName
    00443                         , const XMLCh* const        attrPrefix
    00444                         , const XMLCh* const        attrValue
    00445                         , const XMLAttDef::AttTypes type)
    00446 {
    00447     // Set the name info and the value via their respective calls
    00448     fAttName->setName(attrPrefix, attrName, uriId);
    00449     setValue(attrValue);
    00450
    00451     // And store the type
    00452     fType = type;
    00453 }
    00454
    00455 inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue)
    00456 {
    00457     fType = newValue;
    00458 }
    00459
    00460 inline void XMLAttr::setSpecified(const bool newValue)
    00461 {
    00462     fSpecified = newValue;
    00463 }
    00464
    00465 #endif

Copyright © 2000 The Apache Software Foundation. All Rights Reserved.