![]() |
Rosetta
2019.07
|
class XMLSchemaComplexType represents the definition of the type for an element – that is, the structure of a set of elements with the same name. If an XMLSchemaElement is analogous to a utility::tag::Tag, an XMLSchemaComplexType is analogous to the wiki page describing the valid format for an instance of that Tag. More...
#include <XMLSchemaGeneration.hh>
Public Member Functions | |
XMLSchemaComplexType () | |
XMLSchemaComplexType & | name (std::string const &setting) |
XMLSchemaComplexType & | description (std::string const &setting) |
XMLSchemaComplexType & | set_model_group (XMLSchemaModelGroupCOP model_group) |
XMLSchemaComplexType & | add_attribute (XMLSchemaAttribute attribute) |
XMLSchemaComplexType & | add_attributes (AttributeList const &attributes) |
std::string const & | element_name () const override |
void | write_definition (int indentation, std::ostream &os) const override |
void | prepare_for_output (XMLSchemaDefinition &xsd) const override |
![]() | |
ReferenceCount () | |
Default constructor. More... | |
virtual | ~ReferenceCount () |
Private Attributes | |
std::string | name_ |
std::string | desc_ |
XMLSchemaModelGroupCOP | model_group_ |
std::list< XMLSchemaAttribute > | attributes_ |
Additional Inherited Members | |
![]() | |
typedef platform::Size | Size |
typedef platform::Size | size_type |
class XMLSchemaComplexType represents the definition of the type for an element – that is, the structure of a set of elements with the same name. If an XMLSchemaElement is analogous to a utility::tag::Tag, an XMLSchemaComplexType is analogous to the wiki page describing the valid format for an instance of that Tag.
XMLSchemaComplexTypes can be named or unnamed: if they are named, then the are inserted into the XMLSchemaDefinition on their own, and can be referred to by name in other XMLSchemaElements; if they are unnamed, then they are given as an in-line definition for an XMLSchemaElement. So a name is not required for an XMLSchemaComplexType. That said: the recommended structure for defining an XML Schema is that complex types should be named and to live on their own – elements should refer to these complex types by name.
(There are some who recommend that instead elements be defined at "global scope" – i.e. directly beneath the xs:schema tag – and that complex types be unnamed. The principle disadvantage of that idea is that you cannot have two elements in different contexts with the same name but different structures. This problem of "name collisions" is addressed in XML Schema through the use of "namespacing," which is horrendous, so we won't use it. By giving complex types names, we can avoid name collision by just giving the complex types different names, which has no effect on the apperance of the XML file itself.)
Complex types must be one of the five options in the XMLSchemaComplexTypeType. They are either:
A complex type may refer to a reference type, and then extend that type, e.g. by adding extra attributes.
In the case of a "group" complex type, the complex type needs to contain a subtype. E.g. the group complex-type defined by ResidueSelectorFactory holds a choice complex-type.
Complex types may contain subelements; these subelements can be added through a model group (e.g. "xs:all") that itself contains elements and possibly other model groups.
Complex types may contain attributes; these attributes can be added through the add_attribute method.
Complex types may be repeated, e.g., in the sequence or group cases. You may specify the minimum and maximum number of times the complex type is to appaer.
|
default |
XMLSchemaComplexType & utility::tag::XMLSchemaComplexType::add_attribute | ( | XMLSchemaAttribute | attribute | ) |
XMLSchemaComplexType & utility::tag::XMLSchemaComplexType::add_attributes | ( | AttributeList const & | attributes | ) |
XMLSchemaComplexType & utility::tag::XMLSchemaComplexType::description | ( | std::string const & | setting | ) |
|
overridevirtual |
Implements utility::tag::XMLSchemaTopLevelElement.
References name_.
XMLSchemaComplexType & utility::tag::XMLSchemaComplexType::name | ( | std::string const & | setting | ) |
References name_.
Referenced by utility::tag::XMLSchemaComplexTypeGeneratorImpl::write_complex_type_to_schema().
|
overridevirtual |
Implements utility::tag::XMLSchemaTopLevelElement.
References attributes_, and model_group_.
XMLSchemaComplexType & utility::tag::XMLSchemaComplexType::set_model_group | ( | XMLSchemaModelGroupCOP | model_group | ) |
References model_group_.
Referenced by utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_sequence_of_subelement_sets(), utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_subelement_choice_opt(), utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_subelement_choice_req(), utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_subelement_repeatable(), utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_subelement_single_instance_optional(), utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_subelement_single_instance_required(), and utility::tag::XMLSchemaComplexTypeGeneratorImpl::prepare_subelement_single_instance_required_ordered().
|
overridevirtual |
Implements utility::tag::XMLSchemaTopLevelElement.
References attributes_, desc_, utility::tag::indent_w_spaces(), model_group_, and name_.
|
private |
Referenced by add_attribute(), prepare_for_output(), and write_definition().
|
private |
Referenced by description(), and write_definition().
|
private |
Referenced by prepare_for_output(), set_model_group(), and write_definition().
|
private |
Referenced by description(), element_name(), name(), and write_definition().