Package pyxb :: Package binding :: Module content :: Class Wildcard
[hide private]
[frames] | no frames]

Class Wildcard

source code

    object --+        
             |        
       cscRoot --+    
                 |    
ContentState_mixin --+
                     |
    object --+       |
             |       |
       cscRoot --+   |
                 |   |
ContentModel_mixin --+
                     |
                    Wildcard

Placeholder for wildcard objects.

Instance Methods [hide private]
 
namespaceConstraint(self)
A constraint on the namespace for the wildcard.
source code
 
processContents(self)
Indicate how this wildcard's contents should be processed.
source code
 
__normalizeNamespace(self, nsv) source code
 
__init__(self, *args, **kw)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
matches(self, instance, value)
Return True iff the value is a valid match against this wildcard.
source code
 
newState(self, parent_particle_state)
Return a ContentState_mixin instance that will validate the state of this model component.
source code
 
accepts(self, particle_state, instance, value, element_use)
Determine whether the provided value can be added to the instance without violating state validation.
source code
 
_validate(self, symbol_set, output_sequence)
Determine whether an output sequence created from the symbols can be made consistent with the model.
source code

Inherited from ContentState_mixin: notifyFailure

Inherited from ContentState_mixin (private): _verifyComplete

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

Class Variables [hide private]
  NC_any = '##any'
  NC_not = '##other'
  NC_targetNamespace = '##targetNamespace'
  NC_local = '##local'
  __namespaceConstraint = None
hash(x)
  PC_skip = 'skip'
No namespace constraint is applied to the wildcard.
  PC_lax = 'lax'
Validate against available uniquely determined declaration.
  PC_strict = 'strict'
Validate against declaration or xsi:type, which must be available.
  __processContents = None
One of PC_skip, PC_lax, PC_strict.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

namespaceConstraint(self)

source code 

A constraint on the namespace for the wildcard.

Valid values are:

Namespaces are represented by their URIs. Absence is represented by None, both in the "not" pair and in the set.

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

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • namespace_constraint - Required namespace constraint(s)
  • process_contents - Required
Overrides: object.__init__

matches(self, instance, value)

source code 

Return True iff the value is a valid match against this wildcard.

Validation per Wildcard allows Namespace Name.

newState(self, parent_particle_state)

source code 

Return a ContentState_mixin instance that will validate the state of this model component.

Parameters:
  • parent_particle_state - The ParticleState instance for which this instance is a term. None for the top content model of a complex data type.
Overrides: ContentModel_mixin.newState
(inherited documentation)

accepts(self, particle_state, instance, value, element_use)

source code 

Determine whether the provided value can be added to the instance without violating state validation.

This method must not throw any non-catastrophic exceptions; general failures should be transformed to a False return value.

Parameters:
  • particle_state - The ParticleState instance serving as the parent to this state. The implementation must inform that state when the proposed value completes the content model.
  • instance - An instance of a subclass of basis.complexTypeDefinition, into which the provided value will be stored if it is consistent with the current model state.
  • value - The value that is being validated against the state.
  • element_use - An optional ElementUse instance that specifies the element to which the value corresponds. This will be available when the value is extracted by parsing a document, but will be absent if the value was passed as a constructor positional parameter.
Returns:
True if the value was successfully matched against the state. False if the value did not match against the state.
Overrides: ContentState_mixin.accepts
(inherited documentation)

_validate(self, symbol_set, output_sequence)

source code 

Determine whether an output sequence created from the symbols can be made consistent with the model.

The symbol set represents letters in an alphabet; the output sequence orders those letters in a way that satisfies the regular expression expressed in the model. Both are changed as a result of a successful validation; both remain unchanged if the validation failed. In recursing, implementers may assume that output_sequence is monotonic: its length remains unchanged after an invocation iff the symbol set also remains unchanged. The _validateCloneSymbolSet, _validateCloneOutputSequence, and _validateReplaceResults methods are available to help preserve this behavior.

Parameters:
  • symbol_set - A map from ElementUse instances to a list of values. The order of the values corresponds to the order in which they should appear. A key of None identifies values that are stored as wildcard elements. Values are removed from the lists as they are used; when the last value of a list is removed, its key is removed from the map. Thus an empty dictionary is the indicator that no more symbols are available.
  • output_sequence - A mutable list to which should be appended tuples ( eu, val ) where eu is an ElementUse from the set of symbol keys, and val is a value from the corresponding list. A document generated by producing the elements in the given order is expected to validate.
Returns:
True iff the model validates. symbol_set and output_path will be unchanged if this returns False.
Overrides: ContentModel_mixin._validate
(inherited documentation)