Package pyxb :: Package xmlschema :: Module structures :: Class ElementDeclaration
[hide private]
[frames] | no frames]

Class ElementDeclaration

source code

                               object --+        
                                        |        
                                  cscRoot --+    
                                            |    
                          _ParticleTree_mixin --+
                                                |
                       object --+               |
                                |               |
                          cscRoot --+           |
                                    |           |
 utils.utility.PrivateTransient_mixin --+       |
                                        |       |
                           object --+   |       |
                                    |   |       |
                              cscRoot --+       |
                                        |       |
     namespace._ComponentDependency_mixin --+   |
                                            |   |
                           object --+       |   |
                                    |       |   |
                              cscRoot --+   |   |
                                        |   |   |
namespace.archive._ArchivableObject_mixin --+   |
                                            |   |
                           object --+       |   |
                                    |       |   |
                              cscRoot --+   |   |
                                        |   |   |
     utils.utility.PrivateTransient_mixin --+   |
                                            |   |
                           object --+       |   |
                                    |       |   |
                              cscRoot --+   |   |
                                        |   |   |
            utils.utility.Locatable_mixin --+   |
                                            |   |
                       _SchemaComponent_mixin --+
                                                |
                           object --+           |
                                    |           |
                              cscRoot --+       |
                                        |       |
     utils.utility.PrivateTransient_mixin --+   |
                                            |   |
                               object --+   |   |
                                        |   |   |
                                  cscRoot --+   |
                                            |   |
                        _NamedComponent_mixin --+
                                                |
                               object --+       |
                                        |       |
                                  cscRoot --+   |
                                            |   |
       namespace.resolution._Resolvable_mixin --+
                                                |
                               object --+       |
                                        |       |
                                  cscRoot --+   |
                                            |   |
                             _Annotated_mixin --+
                                                |
                               object --+       |
                                        |       |
                                  cscRoot --+   |
                                            |   |
                       _ValueConstraint_mixin --+
                                                |
                               object --+       |
                                        |       |
                                  cscRoot --+   |
                                            |   |
                     _ScopedDeclaration_mixin --+
                                                |
                                               ElementDeclaration

An XMLSchema Element Declaration component.

Instance Methods [hide private]
 
typeDefinition(self)
The simple or complex type to which the element value conforms.
source code
 
_typeDefinition(self, type_definition) source code
 
nillable(self) source code
 
identityConstraintDefinitions(self)
A list of IdentityConstraintDefinition instances.
source code
 
substitutionGroupAffiliation(self)
None, or a reference to an ElementDeclaration.
source code
 
abstract(self) source code
 
hasWildcardElement(self)
Return False, since element declarations are not wildcards.
source code
frozenset
_bindingRequires_vx(self, include_lax)
Element declarations depend on the type definition of their content.
source code
 
__init__(self, *args, **kw)
Initialize portions of a component.
source code
 
isAdaptable(self, ctd)
Determine whether this element declaration is adaptable.
source code
 
_adaptForScope(self, owner, ctd) source code
 
isResolved(self)
Determine whether this named component is resolved.
source code
 
_resolve(self)
Perform whatever steps are required to resolve this component.
source code
 
_walkParticleTree(self, visit, arg)
Mix-in supporting walks of Particle trees.
source code
 
__str__(self)
str(x)
source code

Inherited from _SchemaComponent_mixin: bestNCName, facStateSortKey, hasBinding, isTypeDefinition, isUrTypeDefinition, nameInBinding, owner, schemaOrderSortKey, setNameInBinding

Inherited from namespace._ComponentDependency_mixin: bindingRequires

Inherited from _NamedComponent_mixin: __getnewargs__, __getstate__, __setstate__, bindingNamespace, expandedName, isAnonymous, isDerivationConsistent, isNameEquivalent, isTypeEquivalent, name, targetNamespace

Inherited from _Annotated_mixin: annotation

Inherited from _Annotated_mixin (private): _annotationFromDOM

Inherited from _ValueConstraint_mixin: default, fixed, valueConstraint

Inherited from _ScopedDeclaration_mixin: baseDeclaration, scope

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

Class Methods [hide private]
 
CreateFromDOM(cls, node, **kw)
Create an element declaration from the given DOM node.
source code

Inherited from _ScopedDeclaration_mixin: IsValidScope, ScopeIsGlobal, ScopeIsIndeterminate

Static Methods [hide private]

Inherited from _NamedComponent_mixin: __new__

Class Variables [hide private]
  __typeDefinition = None
hash(x)
  __substitutionGroupAttribute = None
hash(x)
  __typeAttribute = None
hash(x)
  __nillable = False
  __identityConstraintDefinitions = None
hash(x)
  __substitutionGroupAffiliation = None
hash(x)
  SGE_none = 0
  SGE_extension = 1
  SGE_restriction = 2
  SGE_substitution = 4
  _SGE_Map = {'extension': 1, 'restriction': 2}
  _DS_Map = {'extension': 1, 'restriction': 2, 'substitution': 4}
  __substitutionGroupExclusions = 0
  __disallowedSubstitutions = 0
  __abstract = False
  __isResolved = False

Inherited from _ValueConstraint_mixin: VC_default, VC_fixed, VC_na

Inherited from _ScopedDeclaration_mixin: SCOPE_global, XSCOPE_indeterminate

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_bindingRequires_vx(self, include_lax)

source code 

Element declarations depend on the type definition of their content.

Returns: frozenset
The component instances on which this component depends
Raises:
  • LogicError - A subclass failed to implement this method
Overrides: namespace._ComponentDependency_mixin._bindingRequires_vx

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

source code 

Initialize portions of a component.

Parameters:
  • scope - The scope in which the component is defined
  • namespace_context - The NamespaceContext to use within this component
  • node - If no namespace_context is provided, a DOM node must be provided from which a namespace context can be identified.
  • owner - Reference to the component that owns this one (the immediately enclosing component). Is None in the case of top-level components.
  • schema - Reference to the Schema component to which the component belongs. Required for every component except Schema, Annotation, and Wildcard.
Overrides: object.__init__
(inherited documentation)

CreateFromDOM(cls, node, **kw)
Class Method

source code 

Create an element declaration from the given DOM node.

wxs is a Schema instance within which the element is being declared.

scope is the _ScopeDeclaration_mixin context into which the element declaration is recorded. It can be SCOPE_global, a complex type definition, or None in the case of elements declared in a named model group.

node is a DOM element. The name must be 'element', and the node must be in the XMLSchema namespace.

isAdaptable(self, ctd)

source code 

Determine whether this element declaration is adaptable.

OK, this gets ugly. First, if this declaration isn't resolved, it's clearly not adaptable.

Now: For it to be adaptable, we must know enough about its type to verify that it is derivation-consistent with any other uses of the same name in the same complex type. If the element's type is resolved, that's good enough.

If the element's type isn't resolved, we're golden as long as type-equivalent types were used. But it's also allowed for the derived ctd to use the element name constraining it to a derivation of the element base type. (Go see namespace http://www.opengis.net/ows/1.1 types PositionType, PositionType2D, BoundingBox, and WGS84BoundingBox for an example). So, we really do have to have the element's type resolved.

Except that if a CTD's content incorporates an element with the same type as the CTD (i.e., nested), this will never happen, because the CTD can't get resolved until after it has been resolved. (Go see {http://www.opengis.net/ows/1.1}ContentsBaseType and {http://www.opengis.net/ows/1.1}DatasetDescriptionSummaryBaseType for an example).

So, we give the world a break and assume that if the type we're trying to resolve is the same as the type of an element in that type, then the element type will be resolved by the point it's needed. In point of fact, it won't, but we'll only notice that if a CTD contains an element whose type is a restriction of the CTD. In that case, isDerivationConsistent will blow chunks and somebody'll have to come back and finish up this mess.

isResolved(self)

source code 

Determine whether this named component is resolved.

Override this in the child class.

Overrides: namespace.resolution._Resolvable_mixin.isResolved
(inherited documentation)

_resolve(self)

source code 

Perform whatever steps are required to resolve this component.

Resolution is performed in the context of the namespace to which the component belongs. Invoking this method may fail to complete the resolution process if the component itself depends on unresolved components. The sole caller of this should be _NamespaceResolution_mixin.resolveDefinitions.

This method is permitted (nay, encouraged) to raise an exception if resolution requires interpreting a QName and the named component cannot be found.

Override this in the child class. In the prefix, if isResolved is true, return right away. If something prevents you from completing resolution, invoke self._queueForResolution() (so it is retried later) and immediately return self. Prior to leaving after successful resolution discard any cached dom node by setting self.__domNode=None.

Returns:
self, whether or not resolution succeeds.
Raises:
Overrides: namespace.resolution._Resolvable_mixin._resolve
(inherited documentation)

_walkParticleTree(self, visit, arg)

source code 

Mix-in supporting walks of Particle trees.

This invokes a provided function on each node in a tree defining the content model of a particle, both on the way down the tree and on the way back up. A standard implementation would be:

 def _walkParticleTree (self, visit, arg):
   visit(self, True, arg)
   self.__term.walkParticleTree(visit, arg)
   visit(self, False, arg)
Parameters:
  • visit - A callable with parameters node, entering, arg where node is an instance of a class inheriting _ParticleTree_mixin, entering indicates tree transition status, and arg is a caller-provided state parameter. entering is True if node has particle children and the call is before they are visited; None if the node has no particle children; and False if node has particle children and they have been visited.
  • arg - The caller-provided state parameter to be passed along with the node and entry/exit status in the invocation of visit.
Overrides: _ParticleTree_mixin._walkParticleTree
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)