00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 #if !defined(XMLELEMENTDECL_HPP)
00155 #define XMLELEMENTDECL_HPP
00156
00157 #include <xercesc/framework/XMLAttr.hpp>
00158 #include <xercesc/framework/XMLAttDefList.hpp>
00159 #include <xercesc/util/XMLString.hpp>
00160 #include <xercesc/util/PlatformUtils.hpp>
00161 #include <xercesc/internal/XSerializable.hpp>
00162
00163 XERCES_CPP_NAMESPACE_BEGIN
00164
00165 class ContentSpecNode;
00166 class XMLContentModel;
00167
00183 class XMLElementDecl : public XSerializable, public XMemory
00184 {
00185 public:
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 enum CreateReasons
00202 {
00203 NoReason
00204 , Declared
00205 , AttList
00206 , InContentModel
00207 , AsRootElem
00208 , JustFaultIn
00209 };
00210
00215 enum LookupOpts
00216 {
00217 AddIfNotFound
00218 , FailIfNotFound
00219 };
00220
00221 enum CharDataOpts
00222 {
00223 NoCharData
00224 , SpacesOk
00225 , AllCharData
00226 };
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 static const unsigned int fgInvalidElemId;
00244 static const unsigned int fgPCDataElemId;
00245 static const XMLCh fgPCDataElemName[];
00246
00247
00248
00249
00250
00251
00254 virtual ~XMLElementDecl();
00256
00257
00258
00259
00260
00261
00264
00295 virtual XMLAttDef* findAttr
00296 (
00297 const XMLCh* const qName
00298 , const unsigned int uriId
00299 , const XMLCh* const baseName
00300 , const XMLCh* const prefix
00301 , const LookupOpts options
00302 , bool& wasAdded
00303 ) const = 0;
00304
00316 virtual XMLAttDefList& getAttDefList() const = 0;
00317
00325 virtual CharDataOpts getCharDataOpts() const = 0;
00326
00333 virtual bool hasAttDefs() const = 0;
00334
00342 virtual bool resetDefs() = 0;
00343
00351 virtual const ContentSpecNode* getContentSpec() const = 0;
00352
00358 virtual ContentSpecNode* getContentSpec() = 0;
00359
00369 virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
00370
00382 virtual XMLContentModel* getContentModel() = 0;
00383
00395 virtual void setContentModel(XMLContentModel* const newModelToAdopt) = 0;
00396
00409 virtual const XMLCh* getFormattedContentModel () const = 0;
00410
00412
00413
00414
00415
00416
00417
00420
00428 const XMLCh* getBaseName() const;
00429 XMLCh* getBaseName();
00430
00437 unsigned int getURI() const;
00438
00446 const QName* getElementName() const;
00447 QName* getElementName();
00448
00457 const XMLCh* getFullName() const;
00458
00470 CreateReasons getCreateReason() const;
00471
00481 unsigned int getId() const;
00482
00483
00488 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00489
00494 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00495
00496
00506 bool isDeclared() const;
00507
00516 bool isExternal() const;
00517
00525 MemoryManager* getMemoryManager() const;
00526
00528
00529
00530
00531
00532
00533
00536
00547 void setElementName(const XMLCh* const prefix
00548 , const XMLCh* const localPart
00549 , const int uriId );
00550
00560 void setElementName(const XMLCh* const rawName
00561 , const int uriId );
00562
00571 void setElementName(const QName* const elementName);
00572
00583 void setCreateReason(const CreateReasons newReason);
00584
00591 void setId(const unsigned int newId);
00592
00593
00597 void setExternalElemDeclaration(const bool aValue);
00598
00600
00601
00602
00603
00604
00605
00608
00610
00611
00612
00613
00614 DECL_XSERIALIZABLE(XMLElementDecl)
00615
00616 enum objectType
00617 {
00618 Schema
00619 , DTD
00620 , UnKnown
00621 };
00622
00623 virtual XMLElementDecl::objectType getObjectType() const = 0;
00624
00625 static void storeElementDecl(XSerializeEngine& serEng
00626 , XMLElementDecl* const element);
00627
00628 static XMLElementDecl* loadElementDecl(XSerializeEngine& serEng);
00629
00630 protected :
00631
00632
00633
00634 XMLElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00635
00636 private :
00637
00638
00639
00640 XMLElementDecl(const XMLElementDecl&);
00641 XMLElementDecl& operator=(const XMLElementDecl&);
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667 MemoryManager* fMemoryManager;
00668 QName* fElementName;
00669 CreateReasons fCreateReason;
00670 unsigned int fId;
00671 bool fExternalElement;
00672 };
00673
00674
00675
00676
00677
00678 inline const XMLCh* XMLElementDecl::getBaseName() const
00679 {
00680 return fElementName->getLocalPart();
00681 }
00682
00683 inline XMLCh* XMLElementDecl::getBaseName()
00684 {
00685 return fElementName->getLocalPart();
00686 }
00687
00688 inline unsigned int XMLElementDecl::getURI() const
00689 {
00690 return fElementName->getURI();
00691 }
00692
00693 inline const QName* XMLElementDecl::getElementName() const
00694 {
00695 return fElementName;
00696 }
00697
00698 inline QName* XMLElementDecl::getElementName()
00699 {
00700 return fElementName;
00701 }
00702
00703 inline const XMLCh* XMLElementDecl::getFullName() const
00704 {
00705 return fElementName->getRawName();
00706 }
00707
00708 inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const
00709 {
00710 return fCreateReason;
00711 }
00712
00713 inline unsigned int XMLElementDecl::getId() const
00714 {
00715 return fId;
00716 }
00717
00718 inline bool XMLElementDecl::isDeclared() const
00719 {
00720 return (fCreateReason == Declared);
00721 }
00722
00723
00724 inline bool XMLElementDecl::isExternal() const
00725 {
00726 return fExternalElement;
00727 }
00728
00729 inline MemoryManager* XMLElementDecl::getMemoryManager() const
00730 {
00731 return fMemoryManager;
00732 }
00733
00734
00735
00736
00737
00738 inline void
00739 XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason)
00740 {
00741 fCreateReason = newReason;
00742 }
00743
00744 inline void XMLElementDecl::setId(const unsigned int newId)
00745 {
00746 fId = newId;
00747 }
00748
00749
00750 inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue)
00751 {
00752 fExternalElement = aValue;
00753 }
00754
00755 XERCES_CPP_NAMESPACE_END
00756
00757 #endif