te::xsd::Element Class Reference

This class models the element of a XML Schema. More...

#include <Element.h>

Inheritance diagram for te::xsd::Element:
te::xsd::Occurs te::xsd::Identifiable te::xsd::Annotated

Public Member Functions

void addIdentityConstraint (IdentityConstraint *ic)
 It adds an IdentityConstraint to the element. More...
 
 Element (unsigned int minOccurs=1, unsigned int maxOccurs=1, Annotation *ann=0, std::string *id=0)
 Constructor. More...
 
 Element (const Element &rhs)
 Copy constructor. More...
 
AnnotationgetAnnotation () const
 It returns the associated annotation. More...
 
int getBlock ()
 It returns the block value for the element. It prevents an element with a specified type of derivation from being used in place of this element. More...
 
std::string * getDefaultValue () const
 It returns the default value for the element. More...
 
std::string * getFixedValue () const
 It returns the fixed value for the element. More...
 
std::string * getId () const
 It returns a pointer (may be NULL) to the object id. More...
 
const unsigned int getMaxOccurs () const
 It returns the maxOccurs values. More...
 
const unsigned int getMinOccurs () const
 It returns the minOccurs values. More...
 
std::string * getName () const
 It returns the element name or NULL if it doesn't have one. More...
 
QNamegetRef () const
 It returns the reference to a name of another element. More...
 
QNamegetType () const
 It returns the name of a built-in data type, or the name of a simpleType or complexType element. More...
 
bool isAbstract ()
 If the element is "abstract" or not. More...
 
bool isNillable ()
 If the element is "nillable" or not. More...
 
Elementoperator= (const Element &rhs)
 Assignment operator. More...
 
void setAnnotation (Annotation *ann)
 It sets the associated annotation. More...
 
void setAsAbstract (bool v)
 It specifies whether the element can be used in an instance document. More...
 
void setAsNillable (bool v)
 It specifies whether an explicit null value can be assigned to the element. More...
 
void setBlock (int v)
 It prevents an element with a specified type of derivation from being used in place of this element. More...
 
void setContentType (Type *t)
 It sets the content type of the element. More...
 
void setDefaultValue (std::string *v)
 It sets the default value for the element. More...
 
void setFinal (int v)
 It sets the default value of the final attribute on the element element. More...
 
void setFixedValue (std::string *v)
 It sets a fixed value for the element. More...
 
void setId (std::string *id)
 it sets the id. More...
 
void setMaxOccurs (unsigned int maxOccurs)
 It sets the maxOccurs value. More...
 
void setMinOccurs (unsigned int minOccurs)
 It sets the minOccurs value. More...
 
void setName (std::string *name)
 It sets the element name. More...
 
void setRef (QName *ref)
 It sets a reference to a name of another element. More...
 
void setSubstitutionGroup (QName *g)
 It sets the substitution group. More...
 
void setType (QName *t)
 It sets the element type. More...
 
 ~Element ()
 Destructor. More...
 

Static Public Attributes

static const unsigned int unbounded
 Identifer for "unbounded" max values. More...
 

Protected Attributes

unsigned int m_maxOccurs
 It specifies the maximum number of times the any element can occur in the parent element. The value can be any number >= 0, or if you want to set no limit on the maximum number, use the value "unbounded". Default value is 1. (Optional) More...
 
unsigned int m_minOccurs
 It specifies the minimum number of times the any element can occur in the parent element. The value can be any number >= 0. Default value is 1. (Optional) More...
 

Private Attributes

bool m_abstract
 It specifies whether the element can be used in an instance document. True indicates that the element cannot appear in the instance document. Instead, another element whose substitutionGroup attribute contains the qualified name (QName) of this element must appear in this element's place. Default is false. More...
 
int m_block
 It prevents an element with a specified type of derivation from being used in place of this element. (Optional) More...
 
Typem_contentType
 A content of this element. A simpleType or complexType element can be present as a child only if both the ref and type attributes are not present. More...
 
std::string * m_default
 It specifies a default value for the element (can only be used if the element's content is a simple type or text only). More...
 
int m_final
 It sets the default value of the final attribute on the element element. More...
 
std::string * m_fixed
 It ensures that the elements are set to particular value. More...
 
Form m_form
 Here, "unqualified" indicates that this attribute is not required to be qualified with the namespace prefix. "qualified" indicates that this attribute must be qualified with the namespace prefix. The default value is the value of the elementFormDefault attribute of the schema element. (Optional) More...
 
boost::ptr_vector< IdentityConstraintm_identityConstraintVec
 The list of elements related to identity constraint - (key | keyref | unique)*. (Optional) More...
 
std::string * m_name
 It specifies a name for the element. (Optional) More...
 
bool m_nillable
 It specifies whether an explicit null value can be assigned to the element. True enables an instance of the element to have the null attribute set to true. The null attribute is defined as part of the XML Schema namespace for instances. Default is false. More...
 
QNamem_ref
 It refers to the name of another element. The ref attribute can include a namespace prefix. More...
 
QNamem_substitutionGroup
 It specifies the element that can be substituted with this element. More...
 
QNamem_type
 It specifies either the name of a built-in data type, or the name of a simpleType or complexType element. (Optional) More...
 

Detailed Description

This class models the element of a XML Schema.

Note
Parent elements: schema, choice, all, sequence, group.

Definition at line 56 of file Element.h.

Constructor & Destructor Documentation

te::xsd::Element::Element ( unsigned int  minOccurs = 1,
unsigned int  maxOccurs = 1,
Annotation ann = 0,
std::string *  id = 0 
)

Constructor.

Parameters
idIt specifies a unique ID for the element. It can be a NULL value.
te::xsd::Element::Element ( const Element rhs)

Copy constructor.

Parameters
rhsRight-hand-side object.
te::xsd::Element::~Element ( )

Destructor.

Member Function Documentation

void te::xsd::Element::addIdentityConstraint ( IdentityConstraint ic)

It adds an IdentityConstraint to the element.

Parameters
icThe IdentityConstraint that will be added.
Note
The element will take the ownership of the given constraint.
Annotation* te::xsd::Annotated::getAnnotation ( ) const
inherited

It returns the associated annotation.

Returns
The associated annotation.
int te::xsd::Element::getBlock ( )

It returns the block value for the element. It prevents an element with a specified type of derivation from being used in place of this element.

Returns
The block value. It can be: #all | list of (extension|restriction).
std::string* te::xsd::Element::getDefaultValue ( ) const

It returns the default value for the element.

Returns
The default value for the element.
std::string* te::xsd::Element::getFixedValue ( ) const

It returns the fixed value for the element.

Returns
The fixed value for the element.
std::string* te::xsd::Identifiable::getId ( ) const
inherited

It returns a pointer (may be NULL) to the object id.

const unsigned int te::xsd::Occurs::getMaxOccurs ( ) const
inherited

It returns the maxOccurs values.

Returns
The maxOccurs value.
const unsigned int te::xsd::Occurs::getMinOccurs ( ) const
inherited

It returns the minOccurs values.

Returns
The minOccurs value.
std::string* te::xsd::Element::getName ( ) const

It returns the element name or NULL if it doesn't have one.

Returns
The element name or NULL if it doesn't have one.
QName* te::xsd::Element::getRef ( ) const

It returns the reference to a name of another element.

Returns
The reference to a name of another element.
QName* te::xsd::Element::getType ( ) const

It returns the name of a built-in data type, or the name of a simpleType or complexType element.

Returns
The name of a built-in data type, or the name of a simpleType or complexType element.
bool te::xsd::Element::isAbstract ( )

If the element is "abstract" or not.

Returns
True if the element is "abstract" and false if not.
bool te::xsd::Element::isNillable ( )

If the element is "nillable" or not.

Returns
True if the element is "nillable" and false if not.
Element& te::xsd::Element::operator= ( const Element rhs)

Assignment operator.

Parameters
rhsRight-hand-side object.
Returns
A reference to this object.
void te::xsd::Annotated::setAnnotation ( Annotation ann)
inherited

It sets the associated annotation.

Parameters
annThe annotation to be associated to the object. The annotated class will take the ownership of the given pointer.
void te::xsd::Element::setAsAbstract ( bool  v)

It specifies whether the element can be used in an instance document.

Parameters
vTrue indicates that the element cannot appear in the instance document. Instead, another element whose substitutionGroup attribute contains the qualified name (QName) of this element must appear in this element's place.
void te::xsd::Element::setAsNillable ( bool  v)

It specifies whether an explicit null value can be assigned to the element.

Parameters
vTrue enables an instance of the element to have the null attribute set to true.
void te::xsd::Element::setBlock ( int  v)

It prevents an element with a specified type of derivation from being used in place of this element.

Parameters
vIt can be: #all|list of (extension|restriction).
void te::xsd::Element::setContentType ( Type t)

It sets the content type of the element.

Parameters
tThe content type of the element.
Note
The element will take the ownership of the given type.
void te::xsd::Element::setDefaultValue ( std::string *  v)

It sets the default value for the element.

Parameters
vThe element default value.
Note
The element will take the ownership of the given value.
void te::xsd::Element::setFinal ( int  v)

It sets the default value of the final attribute on the element element.

Parameters
vIt can be: #all|list of (extension|restriction).
void te::xsd::Element::setFixedValue ( std::string *  v)

It sets a fixed value for the element.

Parameters
vA fixed value for the element.
Note
The element will take the ownership of the given value.
void te::xsd::Identifiable::setId ( std::string *  id)
inherited

it sets the id.

Parameters
idThe id to be associated to the object. It will take the ownership of the given string.
void te::xsd::Occurs::setMaxOccurs ( unsigned int  maxOccurs)
inherited

It sets the maxOccurs value.

Parameters
maxOccursThe maxOccurs value. The value can be any number >= 0.
Note
If you want to set no limit on the maximum number, use the value "unbounded" defined as te::xsd::Occurs::unbounded.
void te::xsd::Occurs::setMinOccurs ( unsigned int  minOccurs)
inherited

It sets the minOccurs value.

Parameters
minOccursThe minOccurs value. The value can be any number >= 0.
void te::xsd::Element::setName ( std::string *  name)

It sets the element name.

Parameters
nameThe element name.
Note
The element will take the ownership of the given name.
Setting a name will turn to NULL the reference property.
void te::xsd::Element::setRef ( QName ref)

It sets a reference to a name of another element.

Parameters
refA reference to a name of another element.
Note
Setting a reference property will turn to NULL the name.
The LocalElement object will take the ownership of the given pointer.
void te::xsd::Element::setSubstitutionGroup ( QName g)

It sets the substitution group.

Parameters
gThe substitution group.
Note
The element will take the ownership of the given substitution group.
void te::xsd::Element::setType ( QName t)

It sets the element type.

Parameters
tThe element type.
Note
The element will take the ownership of the given type.

Member Data Documentation

bool te::xsd::Element::m_abstract
private

It specifies whether the element can be used in an instance document. True indicates that the element cannot appear in the instance document. Instead, another element whose substitutionGroup attribute contains the qualified name (QName) of this element must appear in this element's place. Default is false.

Definition at line 262 of file Element.h.

int te::xsd::Element::m_block
private

It prevents an element with a specified type of derivation from being used in place of this element. (Optional)

Definition at line 263 of file Element.h.

Type* te::xsd::Element::m_contentType
private

A content of this element. A simpleType or complexType element can be present as a child only if both the ref and type attributes are not present.

Definition at line 265 of file Element.h.

std::string* te::xsd::Element::m_default
private

It specifies a default value for the element (can only be used if the element's content is a simple type or text only).

Definition at line 258 of file Element.h.

int te::xsd::Element::m_final
private

It sets the default value of the final attribute on the element element.

Definition at line 264 of file Element.h.

std::string* te::xsd::Element::m_fixed
private

It ensures that the elements are set to particular value.

Definition at line 259 of file Element.h.

Form te::xsd::Element::m_form
private

Here, "unqualified" indicates that this attribute is not required to be qualified with the namespace prefix. "qualified" indicates that this attribute must be qualified with the namespace prefix. The default value is the value of the elementFormDefault attribute of the schema element. (Optional)

Definition at line 260 of file Element.h.

boost::ptr_vector<IdentityConstraint> te::xsd::Element::m_identityConstraintVec
private

The list of elements related to identity constraint - (key | keyref | unique)*. (Optional)

Definition at line 266 of file Element.h.

unsigned int te::xsd::Occurs::m_maxOccurs
protectedinherited

It specifies the maximum number of times the any element can occur in the parent element. The value can be any number >= 0, or if you want to set no limit on the maximum number, use the value "unbounded". Default value is 1. (Optional)

Definition at line 113 of file Occurs.h.

unsigned int te::xsd::Occurs::m_minOccurs
protectedinherited

It specifies the minimum number of times the any element can occur in the parent element. The value can be any number >= 0. Default value is 1. (Optional)

Definition at line 112 of file Occurs.h.

std::string* te::xsd::Element::m_name
private

It specifies a name for the element. (Optional)

Definition at line 254 of file Element.h.

bool te::xsd::Element::m_nillable
private

It specifies whether an explicit null value can be assigned to the element. True enables an instance of the element to have the null attribute set to true. The null attribute is defined as part of the XML Schema namespace for instances. Default is false.

Definition at line 261 of file Element.h.

QName* te::xsd::Element::m_ref
private

It refers to the name of another element. The ref attribute can include a namespace prefix.

Definition at line 255 of file Element.h.

QName* te::xsd::Element::m_substitutionGroup
private

It specifies the element that can be substituted with this element.

Definition at line 257 of file Element.h.

QName* te::xsd::Element::m_type
private

It specifies either the name of a built-in data type, or the name of a simpleType or complexType element. (Optional)

Definition at line 256 of file Element.h.

const unsigned int te::xsd::Occurs::unbounded
staticinherited

Identifer for "unbounded" max values.

Definition at line 108 of file Occurs.h.


The documentation for this class was generated from the following file: