http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

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.4  2002/11/28 20:12:45  knoaman
00060  * Allow creating/setting of XMLAttr using a rawname (i.e. 'prefix:localpart').
00061  *
00062  * Revision 1.3  2002/11/04 15:00:21  tng
00063  * C++ Namespace Support.
00064  *
00065  * Revision 1.2  2002/02/20 18:17:01  tng
00066  * [Bug 5977] Warnings on generating apiDocs.
00067  *
00068  * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
00069  * sane_include
00070  *
00071  * Revision 1.9  2001/11/02 14:21:18  knoaman
00072  * Add support for identity constraints.
00073  *
00074  * Revision 1.8  2001/05/11 13:25:31  tng
00075  * Copyright update.
00076  *
00077  * Revision 1.7  2001/02/27 18:33:55  tng
00078  * Schema: Use QName in XMLAttr.
00079  *
00080  * Revision 1.6  2000/04/10 22:42:53  roddey
00081  * Extended the buffer reuse to the QName field, to further increase
00082  * performance of attribute heavy applications.
00083  *
00084  * Revision 1.5  2000/03/02 19:54:24  roddey
00085  * This checkin includes many changes done while waiting for the
00086  * 1.1.0 code to be finished. I can't list them all here, but a list is
00087  * available elsewhere.
00088  *
00089  * Revision 1.4  2000/02/24 20:00:22  abagchi
00090  * Swat for removing Log from API docs
00091  *
00092  * Revision 1.3  2000/02/15 01:21:30  roddey
00093  * Some initial documentation improvements. More to come...
00094  *
00095  * Revision 1.2  2000/02/06 07:47:47  rahulj
00096  * Year 2K copyright swat.
00097  *
00098  * Revision 1.1.1.1  1999/11/09 01:08:28  twl
00099  * Initial checkin
00100  *
00101  * Revision 1.2  1999/11/08 20:44:35  rahul
00102  * Swat for adding in Product name and CVS comment log variable.
00103  *
00104  */
00105 
00106 #if !defined(XMLATTR_HPP)
00107 #define XMLATTR_HPP
00108 
00109 #include <xercesc/util/XMLString.hpp>
00110 #include <xercesc/util/QName.hpp>
00111 #include <xercesc/framework/XMLAttDef.hpp>
00112 
00113 XERCES_CPP_NAMESPACE_BEGIN
00114 
00136 class  XMLAttr
00137 {
00138 public:
00139     // -----------------------------------------------------------------------
00140     //  Constructors and Destructor
00141     // -----------------------------------------------------------------------
00144 
00150     XMLAttr();
00151 
00178     XMLAttr
00179     (
00180         const   unsigned int        uriId
00181         , const XMLCh* const        attrName
00182         , const XMLCh* const        attrPrefix
00183         , const XMLCh* const        attrValue
00184         , const XMLAttDef::AttTypes type = XMLAttDef::CData
00185         , const bool                specified = true
00186     );
00187 
00210     XMLAttr
00211     (
00212         const unsigned int uriId
00213         , const XMLCh* const rawName
00214         , const XMLCh* const attrValue
00215         , const XMLAttDef::AttTypes type = XMLAttDef::CData
00216         , const bool specified = true
00217     );
00218 
00220 
00223     ~XMLAttr();
00225 
00226 
00227     // -----------------------------------------------------------------------
00228     //  Getter methods
00229     // -----------------------------------------------------------------------
00230 
00233 
00237     QName* getAttName() const;
00238 
00243     const XMLCh* getName() const;
00244 
00249     const XMLCh* getPrefix() const;
00250 
00256     const XMLCh* getQName() const;
00257 
00262     bool getSpecified() const;
00263 
00268     XMLAttDef::AttTypes getType() const;
00269 
00275     const XMLCh* getValue() const;
00276 
00281     unsigned int getURIId() const;
00282 
00284 
00285 
00286     // -----------------------------------------------------------------------
00287     //  Setter methods
00288     // -----------------------------------------------------------------------
00289 
00292 
00317     void set
00318     (
00319         const   unsigned int        uriId
00320         , const XMLCh* const        attrName
00321         , const XMLCh* const        attrPrefix
00322         , const XMLCh* const        attrValue
00323         , const XMLAttDef::AttTypes type = XMLAttDef::CData
00324     );
00325 
00346     void set
00347     (
00348         const   unsigned int        uriId
00349         , const XMLCh* const        attrRawName
00350         , const XMLCh* const        attrValue
00351         , const XMLAttDef::AttTypes type = XMLAttDef::CData
00352     );
00353 
00368     void setName
00369     (
00370         const   unsigned int        uriId
00371         , const XMLCh* const        attrName
00372         , const XMLCh* const        attrPrefix
00373     );
00374 
00382     void setSpecified(const bool newValue);
00383 
00392     void setType(const XMLAttDef::AttTypes newType);
00393 
00401     void setValue(const XMLCh* const newValue);
00402 
00410     void setURIId(const unsigned int uriId);
00411 
00413 
00414 
00415 
00416 private :
00417     // -----------------------------------------------------------------------
00418     //  Unimplemented constructors and operators
00419     // -----------------------------------------------------------------------
00420     XMLAttr(const XMLAttr&);
00421     XMLAttr& operator=(const XMLAttr&);
00422 
00423 
00424     // -----------------------------------------------------------------------
00425     //  Private, helper methods
00426     // -----------------------------------------------------------------------
00427     void cleanUp();
00428 
00429 
00430     // -----------------------------------------------------------------------
00431     //  Private instance variables
00432     //
00433     //  fAttName
00434     //      The Attribute Name;
00435     //
00436     //  fSpecified
00437     //      True if this attribute appeared in the element; else, false if
00438     //      it was defaulted from an AttDef.
00439     //
00440     //  fType
00441     //      The attribute type enum value for this attribute. Indicates what
00442     //      type of attribute it was.
00443     //
00444     //  fValue
00445     //  fValueBufSz
00446     //      The attribute value that was given in the attribute instance, and
00447     //      its current buffer size (minus one, where the null is.)
00448     //
00449     // -----------------------------------------------------------------------
00450     bool                fSpecified;
00451     XMLAttDef::AttTypes fType;
00452     XMLCh*              fValue;
00453     unsigned int        fValueBufSz;
00454     QName*              fAttName;
00455 };
00456 
00457 // ---------------------------------------------------------------------------
00458 //  XMLAttr: Constructors and Destructor
00459 // ---------------------------------------------------------------------------
00460 inline XMLAttr::~XMLAttr()
00461 {
00462     cleanUp();
00463 }
00464 
00465 
00466 // ---------------------------------------------------------------------------
00467 //  XMLAttr: Getter methods
00468 // ---------------------------------------------------------------------------
00469 inline QName* XMLAttr::getAttName() const
00470 {
00471     return fAttName;
00472 }
00473 
00474 inline const XMLCh* XMLAttr::getName() const
00475 {
00476     return fAttName->getLocalPart();
00477 }
00478 
00479 inline const XMLCh* XMLAttr::getPrefix() const
00480 {
00481     return fAttName->getPrefix();
00482 }
00483 
00484 inline bool XMLAttr::getSpecified() const
00485 {
00486     return fSpecified;
00487 }
00488 
00489 inline XMLAttDef::AttTypes XMLAttr::getType() const
00490 {
00491     return fType;
00492 }
00493 
00494 inline const XMLCh* XMLAttr::getValue() const
00495 {
00496     return fValue;
00497 }
00498 
00499 inline unsigned int XMLAttr::getURIId() const
00500 {
00501     return fAttName->getURI();
00502 }
00503 
00504 
00505 // ---------------------------------------------------------------------------
00506 //  XMLAttr: Setter methods
00507 // ---------------------------------------------------------------------------
00508 inline void XMLAttr::set(const  unsigned int        uriId
00509                         , const XMLCh* const        attrName
00510                         , const XMLCh* const        attrPrefix
00511                         , const XMLCh* const        attrValue
00512                         , const XMLAttDef::AttTypes type)
00513 {
00514     // Set the name info and the value via their respective calls
00515     fAttName->setName(attrPrefix, attrName, uriId);
00516     setValue(attrValue);
00517 
00518     // And store the type
00519     fType = type;
00520 }
00521 
00522 inline void XMLAttr::set(const  unsigned int        uriId
00523                         , const XMLCh* const        attrRawName
00524                         , const XMLCh* const        attrValue
00525                         , const XMLAttDef::AttTypes type)
00526 {
00527     // Set the name info and the value via their respective calls
00528     fAttName->setName(attrRawName, uriId);
00529     setValue(attrValue);
00530 
00531     // And store the type
00532     fType = type;
00533 }
00534 
00535 inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue)
00536 {
00537     fType = newValue;
00538 }
00539 
00540 inline void XMLAttr::setSpecified(const bool newValue)
00541 {
00542     fSpecified = newValue;
00543 }
00544 
00545 XERCES_CPP_NAMESPACE_END
00546 
00547 #endif


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