Xerces-C++
3.1.2
|
This class defines the core information of an element declaration. More...
Public Types | |
enum | CreateReasons { NoReason, Declared, AttList, InContentModel, AsRootElem, JustFaultIn } |
enum | CharDataOpts { NoCharData, SpacesOk, AllCharData } |
enum | objectType { Schema, DTD, UnKnown } |
Public Member Functions | |
virtual XMLElementDecl::objectType | getObjectType () const =0 |
Destructor | |
virtual | ~XMLElementDecl () |
Virual ElementDecl interface | |
virtual XMLAttDefList & | getAttDefList () const =0 |
Get a list of attributes defined for this element. More... | |
virtual CharDataOpts | getCharDataOpts () const =0 |
The character data options for this element type. More... | |
virtual bool | hasAttDefs () const =0 |
Indicate whether this element type defined any attributes. More... | |
virtual const ContentSpecNode * | getContentSpec () const =0 |
Get a pointer to the content spec node. More... | |
virtual ContentSpecNode * | getContentSpec ()=0 |
Get a pointer to the content spec node. More... | |
virtual void | setContentSpec (ContentSpecNode *toAdopt)=0 |
Set the content spec node object for this element type. More... | |
virtual XMLContentModel * | getContentModel ()=0 |
Get a pointer to the abstract content model. More... | |
virtual void | setContentModel (XMLContentModel *const newModelToAdopt)=0 |
Set the content model object for this element type. More... | |
virtual const XMLCh * | getFormattedContentModel () const =0 |
Geta formatted string of the content model. More... | |
Getter methods | |
const XMLCh * | getBaseName () const |
Get the base name of this element type. More... | |
XMLCh * | getBaseName () |
unsigned int | getURI () const |
Get the URI id of this element type. More... | |
const QName * | getElementName () const |
Get the QName of this element type. More... | |
QName * | getElementName () |
const XMLCh * | getFullName () const |
Get the full name of this element type. More... | |
CreateReasons | getCreateReason () const |
Get the create reason for this element type. More... | |
XMLSize_t | getId () const |
Get the element decl pool id for this element type. More... | |
bool | isDeclared () const |
Indicate whether this element type has been declared yet. More... | |
bool | isExternal () const |
Indicate whether this element type has been declared externally. More... | |
MemoryManager * | getMemoryManager () const |
Get the memory manager. More... | |
Setter methods | |
void | setElementName (const XMLCh *const prefix, const XMLCh *const localPart, const int uriId) |
Set the element name object for this element type. More... | |
void | setElementName (const XMLCh *const rawName, const int uriId) |
Set the element name object for this element type. More... | |
void | setElementName (const QName *const elementName) |
Set the element name object for this element type. More... | |
void | setCreateReason (const CreateReasons newReason) |
Update the create reason for this element type. More... | |
void | setId (const XMLSize_t newId) |
Set the element decl pool id for this element type. More... | |
void | setExternalElemDeclaration (const bool aValue) |
Set the element decl to indicate external declaration. More... | |
Public Member Functions inherited from XMemory | |
void * | operator new (size_t size) |
This method overrides operator new. More... | |
void * | operator new (size_t size, MemoryManager *memMgr) |
This method defines a custom operator new, that will use the provided memory manager to perform the allocation. More... | |
void * | operator new (size_t size, void *ptr) |
This method overrides placement operator new. More... | |
void | operator delete (void *p) |
This method overrides operator delete. More... | |
void | operator delete (void *p, MemoryManager *memMgr) |
This method provides a matching delete for the custom operator new. More... | |
void | operator delete (void *p, void *ptr) |
This method provides a matching delete for the placement new. More... | |
Static Public Member Functions | |
static void | storeElementDecl (XSerializeEngine &serEng, XMLElementDecl *const element) |
static XMLElementDecl * | loadElementDecl (XSerializeEngine &serEng) |
Static Public Attributes | |
static const unsigned int | fgInvalidElemId |
static const unsigned int | fgPCDataElemId |
static const XMLCh | fgPCDataElemName [] |
Protected Member Functions | |
XMLElementDecl (MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager) | |
Protected Member Functions inherited from XMemory | |
XMemory () | |
Protected default constructor. More... | |
This class defines the core information of an element declaration.
Each validator (DTD, Schema, etc...) will have its own information that it associations with the declaration of an element, but they must all share at least this core information, i.e. they must all derive from this class. The set of info enforced at this level is driven by the needs of XML 1.0 spec validation and well formedness checks.
This class defines some special element id values for invalid elements and PCDATA elements, as well as a string for the special PCDATA element name. All validators must honor these special values in order to allow content models to work generically (i.e. to let code know when its dealing with invalid or PCDATA element ids without having to know what type of validator its messing with.)
|
virtual |
|
protected |
|
pure virtual |
Get a list of attributes defined for this element.
The derived class should return a reference to some member object which implements the XMLAttDefList interface. This object gives the scanner the ability to look through the attributes defined for this element.
It is done this way for efficiency, though of course this is not thread safe. The scanner guarantees that it won't ever call this method in any nested way, but the outside world must be careful about when it calls this method, and optimally never would.
const XMLCh * XMLElementDecl::getBaseName | ( | ) | const |
Get the base name of this element type.
Return the base name part of the element's name. This is the same regardless of whether namespaces are enabled or not.
References QName::getLocalPart().
XMLCh * XMLElementDecl::getBaseName | ( | ) |
References QName::getLocalPart().
|
pure virtual |
The character data options for this element type.
The derived class should return an appropriate character data opts value which correctly represents its tolerance towards whitespace or character data inside of its instances. This allows the scanner to do all of the validation of character data.
|
pure virtual |
Get a pointer to the abstract content model.
This method will return a const pointer to the content model object of this element. This class is a simple abstraction that allows an element to define and use multiple, specialized content model types internally but still allow the outside world to do simple stuff with them.
|
pure virtual |
Get a pointer to the content spec node.
This method will return a const pointer to the content spec node object of this element.
|
pure virtual |
Get a pointer to the content spec node.
This method is identical to the previous one, except that it is non const.
XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason | ( | ) | const |
Get the create reason for this element type.
This method returns an enumeration which indicates why this element declaration exists. Elements can be used before they are actually declared, so they will often be faulted into the pool and marked as to why they are there.
const QName * XMLElementDecl::getElementName | ( | ) | const |
QName * XMLElementDecl::getElementName | ( | ) |
|
pure virtual |
Geta formatted string of the content model.
This method is a convenience method which will create a formatted representation of the content model of the element. It will not always exactly recreate the original model, since some normalization or or reformatting may occur. But, it will be a technically accurate representation of the original content model.
const XMLCh * XMLElementDecl::getFullName | ( | ) | const |
Get the full name of this element type.
Return the full name of the element. If namespaces are not enabled, then this is the qName. Else it is the {uri}baseName form. For those validators that always require namespace processing, it will always be in the latter form because namespace processing will always be on.
References QName::getRawName().
XMLSize_t XMLElementDecl::getId | ( | ) | const |
Get the element decl pool id for this element type.
This method will return the element decl pool id of this element declaration. This uniquely identifies this element type within the parse event that it is declared within. This value is assigned by the grammar whose decl pool this object belongs to.
MemoryManager * XMLElementDecl::getMemoryManager | ( | ) | const |
Get the memory manager.
This method returns the configurable memory manager used by the element declaration for dynamic allocation/deallocation.
|
pure virtual |
unsigned int XMLElementDecl::getURI | ( | ) | const |
Get the URI id of this element type.
Return the URI Id of this element.
References QName::getURI().
|
pure virtual |
Indicate whether this element type defined any attributes.
The derived class should return a boolean that indicates whether this element has any attributes defined for it or not. This is an optimization that allows the scanner to skip some work if no attributes exist.
bool XMLElementDecl::isDeclared | ( | ) | const |
Indicate whether this element type has been declared yet.
This method returns a boolean that indicates whether this element has been declared yet. There are a number of reasons why an element declaration can be faulted in, but eventually it must be declared or its an error. See the CreateReasons enumeration.
References Declared.
bool XMLElementDecl::isExternal | ( | ) | const |
Indicate whether this element type has been declared externally.
This method returns a boolean that indicates whether this element has been declared externally.
|
static |
|
pure virtual |
Set the content model object for this element type.
This method will adopt the based content model object. This is called by the actual validator which is parsing its DTD or Schema or whatever a creating an element decl. It will build what it feels is the correct content model type object and store it on the element decl object via this method.
newModelToAdopt | This method will adopt the passed content model object. Any previous object is destroyed. |
|
pure virtual |
Set the content spec node object for this element type.
This method will adopt the based content spec node object. This is called by the actual validator which is parsing its DTD or Schema or whatever and store it on the element decl object via this method.
toAdopt | This method will adopt the passed content node spec object. Any previous object is destroyed. |
void XMLElementDecl::setCreateReason | ( | const CreateReasons | newReason | ) |
Update the create reason for this element type.
This method will update the 'create reason' field for this element decl object. As the validator parses its DTD, Schema, etc... it will encounter various references to an element declaration, which will cause the element declaration to either be declared or to be faulted into the pool in preparation for some future declaration. As it does so,it will update this field to indicate the current status of the decl object.
void XMLElementDecl::setElementName | ( | const XMLCh *const | prefix, |
const XMLCh *const | localPart, | ||
const int | uriId | ||
) |
Set the element name object for this element type.
This method will adopt the based content spec node object. This is called by the actual validator which is parsing its DTD or Schema or whatever and store it on the element decl object via this method.
prefix | Prefix of the element |
localPart | Base Name of the element |
uriId | The uriId of the element |
void XMLElementDecl::setElementName | ( | const XMLCh *const | rawName, |
const int | uriId | ||
) |
Set the element name object for this element type.
This method will adopt the based content spec node object. This is called by the actual validator which is parsing its DTD or Schema or whatever and store it on the element decl object via this method.
rawName | Full Name of the element |
uriId | The uriId of the element |
void XMLElementDecl::setElementName | ( | const QName *const | elementName | ) |
Set the element name object for this element type.
This method will adopt the based content spec node object. This is called by the actual validator which is parsing its DTD or Schema or whatever and store it on the element decl object via this method.
elementName | QName of the element |
void XMLElementDecl::setExternalElemDeclaration | ( | const bool | aValue | ) |
Set the element decl to indicate external declaration.
void XMLElementDecl::setId | ( | const XMLSize_t | newId | ) |
Set the element decl pool id for this element type.
This method will set the pool id of this element decl. This is called by the grammar which created this object, and will provide this decl object with a unique id within the parse event that created it.
|
static |
|
static |
|
static |
|
static |