All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 = std::numeric_limits<unsigned int>::max()
 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
< IdentityConstraint
m_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.

Definition at line 34 of file Element.cpp.

te::xsd::Element::Element ( const Element rhs)

Copy constructor.

Parameters
rhsRight-hand-side object.

Definition at line 53 of file Element.cpp.

te::xsd::Element::~Element ( )

Destructor.

Definition at line 72 of file Element.cpp.

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.

Definition at line 194 of file Element.cpp.

te::xsd::Annotation * te::xsd::Annotated::getAnnotation ( ) const
inherited

It returns the associated annotation.

Returns
The associated annotation.

Definition at line 30 of file Annotated.cpp.

References te::xsd::Annotated::m_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).

Definition at line 110 of file Element.cpp.

std::string * te::xsd::Element::getDefaultValue ( ) const

It returns the default value for the element.

Returns
The default value for the element.

Definition at line 90 of file Element.cpp.

std::string * te::xsd::Element::getFixedValue ( ) const

It returns the fixed value for the element.

Returns
The fixed value for the element.

Definition at line 95 of file Element.cpp.

std::string * te::xsd::Identifiable::getId ( ) const
inherited

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

Definition at line 35 of file Identifiable.cpp.

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

It returns the maxOccurs values.

Returns
The maxOccurs value.

Definition at line 40 of file Occurs.cpp.

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

It returns the minOccurs values.

Returns
The minOccurs value.

Definition at line 35 of file Occurs.cpp.

References te::xsd::Occurs::m_minOccurs.

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.

Definition at line 148 of file Element.cpp.

te::xsd::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.

Definition at line 153 of file Element.cpp.

te::xsd::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.

Definition at line 85 of file Element.cpp.

bool te::xsd::Element::isAbstract ( )

If the element is "abstract" or not.

Returns
True if the element is "abstract" and false if not.

Definition at line 105 of file Element.cpp.

bool te::xsd::Element::isNillable ( )

If the element is "nillable" or not.

Returns
True if the element is "nillable" and false if not.

Definition at line 100 of file Element.cpp.

te::xsd::Element & te::xsd::Element::operator= ( const Element rhs)

Assignment operator.

Parameters
rhsRight-hand-side object.
Returns
A reference to this object.

Definition at line 80 of file Element.cpp.

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.

Definition at line 35 of file Annotated.cpp.

Referenced by te::xsd::serialize::ReadAnnotated().

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.

Definition at line 138 of file Element.cpp.

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.

Definition at line 133 of file Element.cpp.

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).

Definition at line 143 of file Element.cpp.

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.

Definition at line 188 of file Element.cpp.

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.

Definition at line 121 of file Element.cpp.

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).

Definition at line 183 of file Element.cpp.

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.

Definition at line 127 of file Element.cpp.

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.

Definition at line 29 of file Identifiable.cpp.

References te::xsd::Identifiable::m_id.

Referenced by te::xsd::serialize::ReadIdentifiable().

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.

Definition at line 50 of file Occurs.cpp.

Referenced by te::xsd::serialize::ReadOccurs().

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.

Definition at line 45 of file Occurs.cpp.

Referenced by te::xsd::serialize::ReadOccurs().

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.

Definition at line 158 of file Element.cpp.

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.

Definition at line 167 of file Element.cpp.

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.

Definition at line 177 of file Element.cpp.

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.

Definition at line 115 of file Element.cpp.

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.

Referenced by te::xsd::Occurs::operator=().

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.

Referenced by te::xsd::Occurs::getMinOccurs(), and te::xsd::Occurs::operator=().

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 = std::numeric_limits<unsigned int>::max()
staticinherited

Identifer for "unbounded" max values.

Definition at line 108 of file Occurs.h.

Referenced by te::xsd::serialize::ReadOccurs().


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