00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(XERCESC_INCLUDE_GUARD_XMLELEMENTDECL_HPP)
00023 #define XERCESC_INCLUDE_GUARD_XMLELEMENTDECL_HPP
00024
00025 #include <xercesc/framework/XMLAttr.hpp>
00026 #include <xercesc/framework/XMLAttDefList.hpp>
00027 #include <xercesc/util/XMLString.hpp>
00028 #include <xercesc/util/PlatformUtils.hpp>
00029 #include <xercesc/internal/XSerializable.hpp>
00030
00031 XERCES_CPP_NAMESPACE_BEGIN
00032
00033 class ContentSpecNode;
00034 class XMLContentModel;
00035
00051 class XMLPARSER_EXPORT XMLElementDecl : public XSerializable, public XMemory
00052 {
00053 public:
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 enum CreateReasons
00070 {
00071 NoReason
00072 , Declared
00073 , AttList
00074 , InContentModel
00075 , AsRootElem
00076 , JustFaultIn
00077 };
00078
00079 enum CharDataOpts
00080 {
00081 NoCharData
00082 , SpacesOk
00083 , AllCharData
00084 };
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 static const unsigned int fgInvalidElemId;
00102 static const unsigned int fgPCDataElemId;
00103 static const XMLCh fgPCDataElemName[];
00104
00105
00106
00107
00108
00109
00112 virtual ~XMLElementDecl();
00114
00115
00116
00117
00118
00119
00122
00134 virtual XMLAttDefList& getAttDefList() const = 0;
00135
00143 virtual CharDataOpts getCharDataOpts() const = 0;
00144
00151 virtual bool hasAttDefs() const = 0;
00152
00160 virtual const ContentSpecNode* getContentSpec() const = 0;
00161
00167 virtual ContentSpecNode* getContentSpec() = 0;
00168
00178 virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
00179
00191 virtual XMLContentModel* getContentModel() = 0;
00192
00204 virtual void setContentModel(XMLContentModel* const newModelToAdopt) = 0;
00205
00218 virtual const XMLCh* getFormattedContentModel () const = 0;
00219
00221
00222
00223
00224
00225
00226
00229
00237 const XMLCh* getBaseName() const;
00238 XMLCh* getBaseName();
00239
00246 unsigned int getURI() const;
00247
00255 const QName* getElementName() const;
00256 QName* getElementName();
00257
00266 const XMLCh* getFullName() const;
00267
00279 CreateReasons getCreateReason() const;
00280
00290 XMLSize_t getId() const;
00291
00301 bool isDeclared() const;
00302
00311 bool isExternal() const;
00312
00320 MemoryManager* getMemoryManager() const;
00321
00323
00324
00325
00326
00327
00328
00331
00342 void setElementName(const XMLCh* const prefix
00343 , const XMLCh* const localPart
00344 , const int uriId );
00345
00355 void setElementName(const XMLCh* const rawName
00356 , const int uriId );
00357
00366 void setElementName(const QName* const elementName);
00367
00378 void setCreateReason(const CreateReasons newReason);
00379
00386 void setId(const XMLSize_t newId);
00387
00388
00392 void setExternalElemDeclaration(const bool aValue);
00393
00395
00396
00397
00398
00399
00400
00403
00405
00406
00407
00408
00409 DECL_XSERIALIZABLE(XMLElementDecl)
00410
00411 enum objectType
00412 {
00413 Schema
00414 , DTD
00415 , UnKnown
00416 };
00417
00418 virtual XMLElementDecl::objectType getObjectType() const = 0;
00419
00420 static void storeElementDecl(XSerializeEngine& serEng
00421 , XMLElementDecl* const element);
00422
00423 static XMLElementDecl* loadElementDecl(XSerializeEngine& serEng);
00424
00425 protected :
00426
00427
00428
00429 XMLElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00430
00431 private :
00432
00433
00434
00435 XMLElementDecl(const XMLElementDecl&);
00436 XMLElementDecl& operator=(const XMLElementDecl&);
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462 MemoryManager* fMemoryManager;
00463 QName* fElementName;
00464 CreateReasons fCreateReason;
00465 XMLSize_t fId;
00466 bool fExternalElement;
00467 };
00468
00469
00470
00471
00472
00473 inline const XMLCh* XMLElementDecl::getBaseName() const
00474 {
00475 return fElementName->getLocalPart();
00476 }
00477
00478 inline XMLCh* XMLElementDecl::getBaseName()
00479 {
00480 return fElementName->getLocalPart();
00481 }
00482
00483 inline unsigned int XMLElementDecl::getURI() const
00484 {
00485 return fElementName->getURI();
00486 }
00487
00488 inline const QName* XMLElementDecl::getElementName() const
00489 {
00490 return fElementName;
00491 }
00492
00493 inline QName* XMLElementDecl::getElementName()
00494 {
00495 return fElementName;
00496 }
00497
00498 inline const XMLCh* XMLElementDecl::getFullName() const
00499 {
00500 return fElementName->getRawName();
00501 }
00502
00503 inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const
00504 {
00505 return fCreateReason;
00506 }
00507
00508 inline XMLSize_t XMLElementDecl::getId() const
00509 {
00510 return fId;
00511 }
00512
00513 inline bool XMLElementDecl::isDeclared() const
00514 {
00515 return (fCreateReason == Declared);
00516 }
00517
00518
00519 inline bool XMLElementDecl::isExternal() const
00520 {
00521 return fExternalElement;
00522 }
00523
00524 inline MemoryManager* XMLElementDecl::getMemoryManager() const
00525 {
00526 return fMemoryManager;
00527 }
00528
00529
00530
00531
00532
00533 inline void
00534 XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason)
00535 {
00536 fCreateReason = newReason;
00537 }
00538
00539 inline void XMLElementDecl::setId(const XMLSize_t newId)
00540 {
00541 fId = newId;
00542 }
00543
00544
00545 inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue)
00546 {
00547 fExternalElement = aValue;
00548 }
00549
00550 XERCES_CPP_NAMESPACE_END
00551
00552 #endif