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

Class complexTypeDefinition

source code

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

Base for any Python class that serves as the binding for an XMLSchema complexType.

Subclasses should define a class-level _AttributeMap variable which maps from the unicode tag of an attribute to the AttributeUse instance that defines it. Similarly, subclasses should define an _ElementMap variable.

Instance Methods [hide private]
 
wildcardAttributeMap(self)
Obtain access to wildcard attributes.
source code
 
wildcardElements(self)
Obtain access to wildcard elements.
source code
 
__init__(self, *args, **kw)
Create a new instance of this binding.
source code
 
__initializeSimpleContent(self, args, dom_node=None) source code
 
__childrenForDOM(self)
Generate a list of children in the order in which they should be added to the parent when creating a DOM representation of this object.
source code
 
_validatedChildren(self)
Provide the child elements and non-element content in an order consistent with the content model.
source code
 
_symbolSet(self)
Return a map from content.ElementUse instances to a list of values associated with that use.
source code
 
_validateAttributes(self) source code
 
_validateBinding_vx(self)
Override in subclasses for type-specific validation of instance content.
source code
 
_setAttribute(self, attr_en, value) source code
 
xsdConstraintsOK(self)
Validate the content against the simple type.
source code
 
content(self)
Return the content of the element.
source code
 
value(self)
Return the value of the element.
source code
 
_resetContent(self) source code
 
reset(self)
Reset the instance.
source code
 
append(self, value, element_use=None, maybe_element=True, _fallback_namespace=None, require_validation=True, _from_xml=False)
Add the value to the instance.
source code
 
_appendWildcardElement(self, value) source code
 
extend(self, value_list, _fallback_namespace=None, _from_xml=False)
Invoke append for each value in the list, in turn.
source code
 
__setContent(self, value) source code
 
_addContent(self, child, element_binding) source code
 
_postDOMValidate(self) source code
 
_setContentFromDOM(self, node, _fallback_namespace)
Initialize the content of this element from the content of the DOM node.
source code
 
_setDOMFromAttributes(self, dom_support, element)
Add any appropriate attributes from this instance into the DOM element.
source code
 
_toDOM_csc(self, dom_support, parent)
Create a DOM element with the given tag holding the content of this instance.
source code

Inherited from _TypeBinding_mixin: __setattr__, toDOM, toxml, validateBinding

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

Class Methods [hide private]
 
_ConfigureBindingStyle(cls, style) source code
 
_AddElement(cls, element)
Method used by generated code to associate the element binding with a use in this type.
source code
 
_UseForTag(cls, tag, raise_if_fail=True)
Return the ElementUse object corresponding to the element name.
source code
 
_ElementBindingUseForName(cls, element_name)
Determine what the given name means as an element in this type.
source code
 
_IsMixed(cls) source code
 
_IsSimpleTypeContent(cls)
CTDs with simple content are simple; other CTDs are not.
source code
 
_description(cls, name_only=False, user_documentation=True) source code

Inherited from _TypeBinding_mixin: Factory

Class Variables [hide private]
  _CT_EMPTY = 'EMPTY'
  _CT_SIMPLE = 'SIMPLE'
  _CT_MIXED = 'MIXED'
hash(x)
  _CT_ELEMENT_ONLY = 'ELEMENT_ONLY'
  _ContentTypeTag = None
hash(x)
  _TypeDefinition = None
Subclass of simpleTypeDefinition that corresponds to the type content.
  _HasWildcardElement = False
  _ElementMap = {}
Map from expanded names to ElementUse instances.
  __wildcardAttributeMap = None
hash(x)
  __wildcardElements = None
hash(x)
  _ReservedSymbols = set(['Factory', 'append', 'content', 'exten...
There are no reserved symbols in the base class.
  _ContentModel = None
hash(x)
  __content = None
hash(x)
  __modelState = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

wildcardAttributeMap(self)

source code 

Obtain access to wildcard attributes.

The return value is None if this type does not support wildcard attributes. If wildcard attributes are allowed, the return value is a map from QNames to the unicode string value of the corresponding attribute.

To Do: The map keys should be namespace extended names rather than QNames, as the in-scope namespace may not be readily available to the user.

wildcardElements(self)

source code 

Obtain access to wildcard elements.

The return value is None if the content model for this type does not support wildcard elements. If wildcard elements are allowed, the return value is a list of values corresponding to conformant unrecognized elements, in the order in which they were encountered. If the containing binding was created from an XML document and enough information was present to determine the binding of the member element, the value is a binding instance. Otherwise, the value is the original DOM Element node.

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

source code 

Create a new instance of this binding.

Arguments are used as transition values along the content model. Keywords are passed to the constructor of any simple content, or used to initialize attribute and element values whose id (not name) matches the keyword.

Parameters:
Overrides: object.__init__

_AddElement(cls, element)
Class Method

source code 

Method used by generated code to associate the element binding with a use in this type.

This is necessary because all complex type classes appear in the module prior to any of the element instances (which reference type classes), so the association must be formed after the element instances are available.

_UseForTag(cls, tag, raise_if_fail=True)
Class Method

source code 

Return the ElementUse object corresponding to the element name.

Parameters:

__childrenForDOM(self)

source code 

Generate a list of children in the order in which they should be added to the parent when creating a DOM representation of this object.

Note: This is only used when pyxb.RequireValidWhenGenerating has disabled validation. Consequently, it may not generate valid XML.

_validatedChildren(self)

source code 

Provide the child elements and non-element content in an order consistent with the content model.

Returns a sequence of tuples representing a valid path through the content model where each transition corresponds to one of the member element instances within this instance. The tuple is a pair comprising the content.ElementUse instance and the value for the transition.

If the content of the instance does not validate against the content model, None is returned.

The base class implementation uses the content.ParticleModel.validate method. Subclasses may desire to override this in cases where the desired order is not maintained by model interpretation (for example, when an "all" model is used and the original element order is desired). See __childrenForDOM as an example of an alternative approach.

Returns:
None or a list as described above.

_symbolSet(self)

source code 

Return a map from content.ElementUse instances to a list of values associated with that use.

This is used as the set of symbols available for transitions when validating content against a model. Note that the order of values within a use is likely to be significant, although the model cannot detect this.

The value None should be used to provide a list of wildcard members.

If an element use has no associated values, it must not appear in the returned map.

_validateBinding_vx(self)

source code 

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

Returns:
True if the instance validates
Raises:
Overrides: _TypeBinding_mixin._validateBinding_vx
(inherited documentation)

xsdConstraintsOK(self)

source code 

Validate the content against the simple type.

Returns:
True if the content validates against its type.
Raises:

content(self)

source code 

Return the content of the element.

This must be a complex type with complex content. The return value is a list of the element and non-element content in the order in which it was added.

Raises:

value(self)

source code 

Return the value of the element.

This must be a complex type with simple content. The returned value is expected to be an instance of some simpleTypeDefinition class.

Raises:

_resetContent(self)

source code 
Overrides: _TypeBinding_mixin._resetContent

reset(self)

source code 

Reset the instance.

This resets all element and attribute fields, and discards any recorded content. It resets the DFA to the initial state of the content model.

_ElementBindingUseForName(cls, element_name)
Class Method

source code 

Determine what the given name means as an element in this type.

Normally, element_name identifies an element definition within this type. If so, the returned element_use identifies that definition, and the element_binding is extracted from that use.

It may also be that the element_name does not appear as an element definition, but that it identifies a global element. In that case, the returned element_binding identifies the global element. If, further, that element is a member of a substitution group which does have an element definition in this class, then the returned element_use identifies that definition.

If a non-None element_use is returned, there will be an associated element_binding. However, it is possible to return a non-None element_binding, but None as the element_use. In that case, the element_binding can be used to create a binding instance, but the content model will have to treat it as a wildcard.

Parameters:
  • element_name - The name of the element in this type, either an expanded name or a local name if the element has an absent namespace.
Returns:
( element_binding, element_use )

append(self, value, element_use=None, maybe_element=True, _fallback_namespace=None, require_validation=True, _from_xml=False)

source code 

Add the value to the instance.

The value should be a DOM node or other value that is or can be converted to a binding instance. If the instance has a DFA state, the value must be permitted by the content model.

Raises:

_postDOMValidate(self)

source code 
Overrides: _TypeBinding_mixin._postDOMValidate

_toDOM_csc(self, dom_support, parent)

source code 

Create a DOM element with the given tag holding the content of this instance.

Overrides: _TypeBinding_mixin._toDOM_csc

_IsSimpleTypeContent(cls)
Class Method

source code 

CTDs with simple content are simple; other CTDs are not.

Overrides: _TypeBinding_mixin._IsSimpleTypeContent

Class Variable Details [hide private]

_TypeDefinition

Subclass of simpleTypeDefinition that corresponds to the type content. Only valid if _ContentTypeTag is _CT_SIMPLE

Value:
None

_ReservedSymbols

There are no reserved symbols in the base class.

Value:
set(['Factory',
     'append',
     'content',
     'extend',
     'property',
     'reset',
     'toDOM',
     'toxml',
...