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

Class Particle

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 --+   |
                                            |   |
       namespace.resolution._Resolvable_mixin --+
                                                |
                                               Particle

An XMLSchema Particle component.

Instance Methods [hide private]
 
minOccurs(self)
The minimum number of times the term may appear.
source code
 
maxOccurs(self)
Upper limit on number of times the term may appear.
source code
 
term(self)
A reference to a ModelGroup, Wildcard, or ElementDeclaration.
source code
 
effectiveTotalRange(self)
Extend the concept of effective total range to all particles.
source code
 
isEmptiable(self)
Return True iff this particle can legitimately match an empty sequence (no content).
source code
 
hasWildcardElement(self)
Return True iff this particle has a wildcard in its term.
source code
 
__init__(self, term, *args, **kw)
Create a particle from the given DOM node.
source code
 
_resolve(self)
Perform whatever steps are required to resolve this component.
source code
 
isResolved(self)
Determine whether this named component is resolved.
source code
frozenset
_bindingRequires_vx(self, include_lax)
Placeholder for subclass method that identifies the necessary components.
source code
 
_adaptForScope(self, owner, ctd) source code
 
isAdaptable(self, ctd)
A particle has an unresolvable particle if it cannot be resolved, or if it has resolved to a term which is a model group that has an unresolvable particle.
source code
 
walkParticleTree(self, visit, arg)
The entry-point to walk a particle tree defining a content model.
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 utils.utility.PrivateTransient_mixin: __getstate__

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

Class Methods [hide private]
 
CreateFromDOM(cls, node, **kw)
Create a particle from the given DOM node.
source code
 
IsTypedefNode(cls, node) source code
 
IsParticleNode(cls, node, *others) source code
Class Variables [hide private]
  __minOccurs = 1
  __maxOccurs = 1
  __term = None
hash(x)
  __pendingTerm = None
hash(x)
  __refAttribute = None
hash(x)
  __resolvableType = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

minOccurs(self)

source code 

The minimum number of times the term may appear.

Defaults to 1.

maxOccurs(self)

source code 

Upper limit on number of times the term may appear.

If None, the term may appear any number of times; otherwise, this is an integral value indicating the maximum number of times the term may appear. The default value is 1; the value, unless None, must always be at least minOccurs().

effectiveTotalRange(self)

source code 

Extend the concept of effective total range to all particles.

See http://www.w3.org/TR/xmlschema-1/#cos-seq-range and http://www.w3.org/TR/xmlschema-1/#cos-choice-range

isEmptiable(self)

source code 

Return True iff this particle can legitimately match an empty sequence (no content).

See http://www.w3.org/TR/xmlschema-1/#cos-group-emptiable

hasWildcardElement(self)

source code 

Return True iff this particle has a wildcard in its term.

Note that the wildcard may be in a nested model group.

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

source code 

Create a particle from the given DOM node.

term is a XML Schema Component: one of ModelGroup, ElementDeclaration, and Wildcard.

The following keyword arguments are processed:

min_occurs is a non-negative integer value with default 1, denoting the minimum number of terms required by the content model.

max_occurs is a positive integer value with default 1, or None indicating unbounded, denoting the maximum number of terms allowed by the content model.

scope is the _ScopeDeclaration_mxin context that is assigned to declarations that appear within the particle. It can be None, indicating no scope defined, or a complex type definition.

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__

_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)

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)

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

source code 

Create a particle from the given DOM node.

wxs is a Schema instance within which the model group is being defined.

node is a DOM element. The name must be one of ( 'group', 'element', 'any', 'all', 'choice', 'sequence' ), and the node must be in the XMLSchema namespace.

scope is the _ScopeDeclaration_mxin context that is assigned to declarations that appear within the model group. It can be None, indicating no scope defined, or a complex type definition.

_bindingRequires_vx(self, include_lax)

source code 

Placeholder for subclass method that identifies the necessary components.

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
(inherited documentation)

walkParticleTree(self, visit, arg)

source code 

The entry-point to walk a particle tree defining a content model.

See _ParticleTree_mixin._walkParticleTree.

_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)