00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(XMLELEMENTDECL_HPP)
00023 #define 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 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
00083 enum LookupOpts
00084 {
00085 AddIfNotFound
00086 , FailIfNotFound
00087 };
00088
00089 enum CharDataOpts
00090 {
00091 NoCharData
00092 , SpacesOk
00093 , AllCharData
00094 };
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 static const unsigned int fgInvalidElemId;
00112 static const unsigned int fgPCDataElemId;
00113 static const XMLCh fgPCDataElemName[];
00114
00115
00116
00117
00118
00119
00122 virtual ~XMLElementDecl();
00124
00125
00126
00127
00128
00129
00132
00163 virtual XMLAttDef* findAttr
00164 (
00165 const XMLCh* const qName
00166 , const unsigned int uriId
00167 , const XMLCh* const baseName
00168 , const XMLCh* const prefix
00169 , const LookupOpts options
00170 , bool& wasAdded
00171 ) const = 0;
00172
00184 virtual XMLAttDefList& getAttDefList() const = 0;
00185
00193 virtual CharDataOpts getCharDataOpts() const = 0;
00194
00201 virtual bool hasAttDefs() const = 0;
00202
00210 virtual bool resetDefs() = 0;
00211
00219 virtual const ContentSpecNode* getContentSpec() const = 0;
00220
00226 virtual ContentSpecNode* getContentSpec() = 0;
00227
00237 virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
00238
00250 virtual XMLContentModel* getContentModel() = 0;
00251
00263 virtual void setContentModel(XMLContentModel* const newModelToAdopt) = 0;
00264
00277 virtual const XMLCh* getFormattedContentModel () const = 0;
00278
00280
00281
00282
00283
00284
00285
00288
00296 const XMLCh* getBaseName() const;
00297 XMLCh* getBaseName();
00298
00305 unsigned int getURI() const;
00306
00314 const QName* getElementName() const;
00315 QName* getElementName();
00316
00325 const XMLCh* getFullName() const;
00326
00338 CreateReasons getCreateReason() const;
00339
00349 unsigned int getId() const;
00350
00351
00356 virtual const XMLCh* getDOMTypeInfoUri() const = 0;
00357
00362 virtual const XMLCh* getDOMTypeInfoName() const = 0;
00363
00364
00374 bool isDeclared() const;
00375
00384 bool isExternal() const;
00385
00393 MemoryManager* getMemoryManager() const;
00394
00396
00397
00398
00399
00400
00401
00404
00415 void setElementName(const XMLCh* const prefix
00416 , const XMLCh* const localPart
00417 , const int uriId );
00418
00428 void setElementName(const XMLCh* const rawName
00429 , const int uriId );
00430
00439 void setElementName(const QName* const elementName);
00440
00451 void setCreateReason(const CreateReasons newReason);
00452
00459 void setId(const unsigned int newId);
00460
00461
00465 void setExternalElemDeclaration(const bool aValue);
00466
00468
00469
00470
00471
00472
00473
00476
00478
00479
00480
00481
00482 DECL_XSERIALIZABLE(XMLElementDecl)
00483
00484 enum objectType
00485 {
00486 Schema
00487 , DTD
00488 , UnKnown
00489 };
00490
00491 virtual XMLElementDecl::objectType getObjectType() const = 0;
00492
00493 static void storeElementDecl(XSerializeEngine& serEng
00494 , XMLElementDecl* const element);
00495
00496 static XMLElementDecl* loadElementDecl(XSerializeEngine& serEng);
00497
00498 protected :
00499
00500
00501
00502 XMLElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00503
00504 private :
00505
00506
00507
00508 XMLElementDecl(const XMLElementDecl&);
00509 XMLElementDecl& operator=(const XMLElementDecl&);
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535 MemoryManager* fMemoryManager;
00536 QName* fElementName;
00537 CreateReasons fCreateReason;
00538 unsigned int fId;
00539 bool fExternalElement;
00540 };
00541
00542
00543
00544
00545
00546 inline const XMLCh* XMLElementDecl::getBaseName() const
00547 {
00548 return fElementName->getLocalPart();
00549 }
00550
00551 inline XMLCh* XMLElementDecl::getBaseName()
00552 {
00553 return fElementName->getLocalPart();
00554 }
00555
00556 inline unsigned int XMLElementDecl::getURI() const
00557 {
00558 return fElementName->getURI();
00559 }
00560
00561 inline const QName* XMLElementDecl::getElementName() const
00562 {
00563 return fElementName;
00564 }
00565
00566 inline QName* XMLElementDecl::getElementName()
00567 {
00568 return fElementName;
00569 }
00570
00571 inline const XMLCh* XMLElementDecl::getFullName() const
00572 {
00573 return fElementName->getRawName();
00574 }
00575
00576 inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const
00577 {
00578 return fCreateReason;
00579 }
00580
00581 inline unsigned int XMLElementDecl::getId() const
00582 {
00583 return fId;
00584 }
00585
00586 inline bool XMLElementDecl::isDeclared() const
00587 {
00588 return (fCreateReason == Declared);
00589 }
00590
00591
00592 inline bool XMLElementDecl::isExternal() const
00593 {
00594 return fExternalElement;
00595 }
00596
00597 inline MemoryManager* XMLElementDecl::getMemoryManager() const
00598 {
00599 return fMemoryManager;
00600 }
00601
00602
00603
00604
00605
00606 inline void
00607 XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason)
00608 {
00609 fCreateReason = newReason;
00610 }
00611
00612 inline void XMLElementDecl::setId(const unsigned int newId)
00613 {
00614 fId = newId;
00615 }
00616
00617
00618 inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue)
00619 {
00620 fExternalElement = aValue;
00621 }
00622
00623 XERCES_CPP_NAMESPACE_END
00624
00625 #endif