Package pyxb :: Package binding :: Module basis :: Class simpleTypeDefinition
[hide private]
[frames] | no frames]

Class simpleTypeDefinition

source code

                    object --+            
                             |            
                       cscRoot --+        
                                 |        
     utils.utility.Locatable_mixin --+    
                                     |    
                    _TypeBinding_mixin --+
                                         |
                            object --+   |
                                     |   |
utils.utility._DeconflictSymbols_mixin --+
                                         |
                        object --+       |
                                 |       |
                           cscRoot --+   |
                                     |   |
                  _DynamicCreate_mixin --+
                                         |
                                        simpleTypeDefinition
Known Subclasses:

simpleTypeDefinition is a base class that is part of the hierarchy of any class that represents the Python datatype for a SimpleTypeDefinition.


Note: This class, or a descendent of it, must be the first class in the method resolution order when a subclass has multiple parents. Otherwise, constructor keyword arguments may not be removed before passing them on to Python classes that do not accept them.

Instance Methods [hide private]
 
__init__(self, *args, **kw)
Initialize a newly created STD instance.
source code
 
xsdLiteral(self)
Return text suitable for representing the value of this instance in an XML document.
source code
 
xsdConstraintsOK(self, location=None)
Validate the value of this instance against its constraints.
source code
 
_validateBinding_vx(self)
Override in subclasses for type-specific validation of instance content.
source code
 
xsdValueLength(self)
Return the length of this instance within its value space.
source code
 
pythonLiteral(self)
Return a string which can be embedded into Python source to represent the value of this instance.
source code
 
_toDOM_csc(self, dom_support, parent) source code
 
_checkValidValue(self) source code
 
_isValidValue(self) source code
 
_setAttribute(self, attr_en, value) source code

Inherited from _TypeBinding_mixin: __setattr__, toDOM, toxml, validateBinding

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
__FacetMapAttributeName(cls) source code
 
_FacetMap(cls)
Return a reference to the facet map for this datatype.
source code
 
_InitializeFacetMap(cls, *args)
Initialize the facet map for this datatype.
source code
 
_ConvertArguments_vx(cls, args, kw) source code
 
_ConvertArguments(cls, args, kw)
Pre-process the arguments.
source code
 
__STDAttrName(cls) source code
 
_SimpleTypeDefinition(cls, std)
Set the pyxb.xmlschema.structures.SimpleTypeDefinition instance associated with this binding.
source code
 
SimpleTypeDefinition(cls)
Return the SimpleTypeDefinition instance for the given class.
source code
 
XsdLiteral(cls, value)
Convert from a python value to a string usable in an XML document.
source code
 
XsdSuperType(cls)
Find the nearest parent class in the PST hierarchy.
source code
 
_XsdConstraintsPreCheck_vb(cls, value)
Pre-extended class method to verify other things before checking constraints.
source code
 
XsdConstraintsOK(cls, value, location=None)
Validate the given value against the constraints on this class.
source code
 
XsdValueLength(cls, value)
Return the length of the given value.
source code
 
PythonLiteral(cls, value)
Return a string which can be embedded into Python source to represent the given value as an instance of this class.
source code
 
_IsSimpleTypeContent(cls)
STDs have simple type content.
source code
 
_IsValidValue(self, value) source code
 
_CheckValidValue(cls, value)
NB: Invoking this on a value that is a list will, if necessary, replace the members of the list with new values that are of the correct item type.
source code
 
_description(cls, name_only=False, user_documentation=True) source code

Inherited from _TypeBinding_mixin: Factory

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kw) source code
Class Variables [hide private]
  __FacetMap = {}
  _ReservedSymbols = set(['Factory', 'PythonLiteral', 'SimpleTyp...
Symbols that remain the responsibility of this class.
  __FacetMapAttributeNameMap = {<class 'pyxb.binding.basis.STD_l...
  __ClassFacetSequence = {}

Inherited from _TypeBinding_mixin: _validationConfig_

Properties [hide private]

Inherited from _TypeBinding_mixin (private): _validationConfig

Inherited from object: __class__

Method Details [hide private]

_FacetMap(cls)
Class Method

source code 

Return a reference to the facet map for this datatype.

The facet map is a map from leaf facet classes to instances of those classes that constrain or otherwise apply to the lexical or value space of the datatype. Classes may inherit their facet map from their superclass, or may create a new class instance if the class adds a new constraint type.

Raises:
  • AttributeError - if the facet map has not been defined

_InitializeFacetMap(cls, *args)
Class Method

source code 

Initialize the facet map for this datatype.

This must be called exactly once, after all facets belonging to the datatype have been created.

Raises:
  • pyxb.LogicError - if called multiple times (on the same class)
  • pyxb.LogicError - if called when a parent class facet map has not been initialized :return: the facet map

_ConvertArguments(cls, args, kw)
Class Method

source code 

Pre-process the arguments.

This is used before invoking the parent constructor. One application is to apply the whitespace facet processing; if such a request is in the keywords, it is removed so it does not propagate to the superclass. Another application is to convert the arguments from a string to a list. Binding-specific applications are performed in the overloaded _ConvertArguments_vx method.

__new__(cls, *args, **kw)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

__init__(self, *args, **kw)
(Constructor)

source code 

Initialize a newly created STD instance.

Usually there is one positional argument, which is a value that can be converted to the underlying Python type.

Parameters:
  • _validate_constraints (bool) - If True (default if validation is enabled), the newly constructed value is checked against its constraining facets.
  • _apply_attributes - If True (default), any attributes present in the keywords or DOM node are applied. Normally presence of such an attribute should produce an error; when creating simple content for a complex type we need the DOM node, but do not want to apply the attributes, so we bypass the application.
Overrides: object.__init__

SimpleTypeDefinition(cls)
Class Method

source code 

Return the SimpleTypeDefinition instance for the given class.

This should only be invoked when generating bindings. An STD must have been associated with the class using _SimpleTypeDefinition.

XsdLiteral(cls, value)
Class Method

source code 

Convert from a python value to a string usable in an XML document.

This should be implemented in the subclass.

xsdLiteral(self)

source code 

Return text suitable for representing the value of this instance in an XML document.

The base class implementation delegates to the object class's XsdLiteral method.

XsdSuperType(cls)
Class Method

source code 

Find the nearest parent class in the PST hierarchy.

The value for anySimpleType is None; for all others, it's a primitive or derived PST descendent (including anySimpleType).

_XsdConstraintsPreCheck_vb(cls, value)
Class Method

source code 

Pre-extended class method to verify other things before checking constraints.

This is used for list types, to verify that the values in the list are acceptable, and for token descendents, to check the lexical/value space conformance of the input.

XsdConstraintsOK(cls, value, location=None)
Class Method

source code 

Validate the given value against the constraints on this class.

Raises:

_validateBinding_vx(self)

source code 

Override in subclasses for type-specific validation of instance content.

Returns:
True if the instance validates
Raises:
  • pyxb.BatchContentValidationError - complex content does not match model
  • pyxb.SimpleTypeValueError - simple content fails to satisfy constraints
Overrides: _TypeBinding_mixin._validateBinding_vx
(inherited documentation)

XsdValueLength(cls, value)
Class Method

source code 

Return the length of the given value.

The length is calculated by a subclass implementation of _XsdValueLength_vx in accordance with http://www.w3.org/TR/xmlschema-2/#rf-length.

The return value is a non-negative integer, or None if length constraints should be considered trivially satisfied (as with QName and NOTATION).

Raises:
  • pyxb.LogicError - the provided value is not an instance of cls.
  • pyxb.LogicError - an attempt is made to calculate a length for an instance of a type that does not support length calculations.

xsdValueLength(self)

source code 

Return the length of this instance within its value space.

See XsdValueLength.

_toDOM_csc(self, dom_support, parent)

source code 
Overrides: _TypeBinding_mixin._toDOM_csc

_IsSimpleTypeContent(cls)
Class Method

source code 

STDs have simple type content.

Overrides: _TypeBinding_mixin._IsSimpleTypeContent

_CheckValidValue(cls, value)
Class Method

source code 

NB: Invoking this on a value that is a list will, if necessary, replace the members of the list with new values that are of the correct item type. This is permitted because only with lists is it possible to bypass the normal content validation (by invoking append/extend on the list instance).


Class Variable Details [hide private]

_ReservedSymbols

Symbols that remain the responsibility of this class. Any public symbols in generated binding subclasses are deconflicted by providing an alternative name in the subclass. (There currently are no public symbols in generated SimpleTypeDefinion bindings.

Value:
set(['Factory',
     'PythonLiteral',
     'SimpleTypeDefinition',
     'XsdConstraintsOK',
     'XsdLiteral',
     'XsdPythonType',
     'XsdSuperType',
     'XsdValueLength',
...

__FacetMapAttributeNameMap

Value:
{<class 'pyxb.binding.basis.STD_list'>: u'_STD_list_FacetMap',
 <class 'pyxb.binding.basis.STD_union'>: u'_STD_union_FacetMap',
 <class 'pyxb.binding.basis.simpleTypeDefinition'>: '_simpleTypeDefini\
tion__FacetMap',
 <class 'pyxb.binding.datatypes.double'>: u'_httpwww_w3_org2001XMLSche\
ma_double_FacetMap',
 <class 'pyxb.binding.datatypes.duration'>: u'_httpwww_w3_org2001XMLSc\
hema_duration_FacetMap',
...