![]() |
Rosetta
2021.16
|
class XMLSchemaRestriction describes a refinement on the behavior of existing types. For example, one could define a restriction representing a list of residue indexes separating commas: "15,44,102" and then describe an attribute of a complex type as having to conform to that restriction. An xml-schema validator would be able to say that an input file with "fifteen,fortyfour,onehundredandtwo" did not meet the schema. More...
#include <XMLSchemaGeneration.hh>

Public Member Functions | |
| XMLSchemaRestriction () | |
| void | name (std::string const &setting) |
| void | base_type (XMLSchemaType setting) |
| void | add_restriction (XMLSchemaRestrictionType type, std::string const &value) |
| 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 |
Public Member Functions inherited from utility::VirtualBase | |
| VirtualBase ()=default | |
| Default constructor. More... | |
| virtual | ~VirtualBase ()=default |
| The virtual destructor is one of the main reasons for the VirtualBase class. More... | |
| VirtualBase (VirtualBase const &)=default | |
| VirtualBase (VirtualBase &&)=default | |
| VirtualBase & | operator= (VirtualBase const &)=default |
| VirtualBase & | operator= (VirtualBase &&)=default |
Private Attributes | |
| std::string | name_ |
| XMLSchemaType | base_type_ |
| std::list< std::pair < XMLSchemaRestrictionType, std::string > > | restrictions_ |
class XMLSchemaRestriction describes a refinement on the behavior of existing types. For example, one could define a restriction representing a list of residue indexes separating commas: "15,44,102" and then describe an attribute of a complex type as having to conform to that restriction. An xml-schema validator would be able to say that an input file with "fifteen,fortyfour,onehundredandtwo" did not meet the schema.
See the description of XML schema restrictions here: http://www.w3schools.com/xml/schema_facets.asp Restrictions are given as pairs of restriction types and then values for those restriction types. The restriction types are defined in an enumeration in XMLSchemaGeneration.fwd.hh.
An example of a useful XMLSchemaRestriction is oen to define a comma-separated list of integers. The elements in the XMLSchema that would define such a restriction look like this:
/// <xs:simpleType name="int_cslist"> /// <xs:restriction base="xs:string"> /// <xs:pattern value="[0-9]+(,[0-9]+)*"/> /// </xs:restriction> /// </xs:simpleType> ///
|
default |
| void utility::tag::XMLSchemaRestriction::add_restriction | ( | XMLSchemaRestrictionType | type, |
| std::string const & | value | ||
| ) |
| void utility::tag::XMLSchemaRestriction::base_type | ( | XMLSchemaType | setting | ) |
|
overridevirtual |
Implements utility::tag::XMLSchemaTopLevelElement.
References name_.
| void utility::tag::XMLSchemaRestriction::name | ( | std::string const & | setting | ) |
|
overridevirtual |
|
overridevirtual |
Implements utility::tag::XMLSchemaTopLevelElement.
References base_type_, utility::tag::indent_w_spaces(), name_, restrictions_, and utility::tag::XMLSchemaType::type_name().
|
private |
Referenced by base_type(), prepare_for_output(), and write_definition().
|
private |
Referenced by element_name(), name(), and write_definition().
|
private |
Referenced by add_restriction(), and write_definition().
1.8.7