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

# type _ScopedDeclaration_mixin

source code

    object --+
             |
       cscRoot --+
                 |
                _ScopedDeclaration_mixin

Known Subclasses:
  - AttributeDeclaration
  - , ElementDeclaration

Mix-in class for named components that have a scope.

Scope is important when doing cross-namespace inheritance, e.g. extending or restricting a complex type definition that is from a different namespace. In this case, we will need to retain a reference to the external component when the schema is serialized.

This is done in the pickling process by including the scope when pickling a component as a reference. The scope is the SCOPE_global if global; otherwise, it is a tuple containing the external namespace URI and the NCName of the complex type definition in that namespace. We assume that the complex type definition has global scope; otherwise, it should not have been possible to extend or restrict it. (Should this be untrue, there are comments in the code about a possible solution.)

Warning: This mix-in must follow _NamedComponent_mixin in the `mro`.

Instance Methods | [hide private]
_scopeIsCompatible(self, scope) Return True if this scope currently assigned to this instance is compatible with the given scope. | source code
scope(self) The scope for the declaration. | source code
baseDeclaration(self) | source code
_baseDeclaration(self, referenced_declaration) | source code
Inherited from `cscRoot`: `__init__`

Class Methods | [hide private]
IsValidScope(cls, value) | source code
ScopeIsIndeterminate(cls, value) | source code
ScopeIsGlobal(cls, value) | source code

Class Variables | [hide private]
| SCOPE_global = ``'``global``'``
| XSCOPE_indeterminate = ``'``indeterminate``'``
| __baseDeclaration = `None`
| _ScopedDeclaration_mixin__baseDeclaration = `None`

Method Details | [hide private]

### _scopeIsCompatible(self, scope) | source code
Return True if this scope currently assigned to this instance is compatible with the given scope. If either scope is indeterminate, presume they will ultimately be compatible. Scopes that are equal are compatible, as is a local scope if this already has a global scope.

### scope(self) | source code
The scope for the declaration. Valid values are SCOPE_global, or a complex type definition. A value of None means a non-global declaration that is not owned by a complex type definition. These can only appear in attribute group definitions or model group definitions. To Do: For declarations in named model groups (viz., local elements that aren't references), the scope needs to be set by the owning complex type.