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

Class Schema

source code

                       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 --+
                                                |
                                               Schema

An XMLSchema Schema.

Instance Methods [hide private]
 
__getstate__(self) source code
 
location(self)
URI or path to where the schema can be found.
source code
 
locationTag(self) source code
 
signature(self) source code
 
generationUID(self) source code
 
originRecord(self) source code
 
targetNamespace(self)
The targetNamespace of a componen.
source code
 
defaultNamespace(self)
Default namespace of the schema.
source code
 
referencedNamespaces(self) source code
 
importEIIs(self) source code
 
importedSchema(self) source code
 
includedSchema(self) source code
 
_setAttributeFromDOM(self, attr)
Override the schema attribute with the given DOM value.
source code
 
_setAttributesFromMap(self, attr_map)
Override the schema attributes with values from the given map.
source code
 
schemaHasAttribute(self, attr_name)
Return True iff the schema has an attribute with the given (nc)name.
source code
 
schemaAttribute(self, attr_name)
Return the schema attribute value associated with the given (nc)name.
source code
 
_uriContentArchiveDirectory(self) source code
 
__init__(self, *args, **kw)
Initialize portions of a component.
source code
 
__ebvForNode(self, attr, dom_node, candidate_map) source code
 
blockForNode(self, dom_node, candidate_map)
Return a bit mask indicating a set of options read from the node's "block" attribute or the schema's "blockDefault" attribute.
source code
 
finalForNode(self, dom_node, candidate_map)
Return a bit mask indicating a set of options read from the node's "final" attribute or the schema's "finalDefault" attribute.
source code
 
targetNamespaceForNode(self, dom_node, declaration_type)
Determine the target namespace for a local attribute or element declaration.
source code
 
__requireInProlog(self, node_name)
Throw a SchemaValidationException referencing the given node if we have passed the sequence point representing the end of prolog elements.
source code
 
__processInclude(self, node) source code
 
__processImport(self, node)
Process an import directive.
source code
 
__processRedefine(self, node) source code
 
__processAnnotation(self, node) source code
 
__processTopLevelNode(self, node)
Process a DOM node from the top level of the schema.
source code
 
_addAnnotation(self, annotation) source code
 
_addNamedComponent(self, nc) source code
 
__addTypeDefinition(self, td) source code
 
__addAttributeDeclaration(self, ad) source code
 
__addAttributeGroupDefinition(self, agd) source code
 
__str__(self)
str(x)
source code

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

Inherited from namespace._ComponentDependency_mixin: bindingRequires

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

Class Methods [hide private]
 
CreateFromDocument(cls, xmls, **kw) source code
 
CreateFromLocation(cls, **kw)
Create a schema from a schema location.
source code
 
CreateFromStream(cls, stream, **kw) source code
 
CreateFromDOM(cls, node, namespace_context=None, schema_location=None, schema_signature=None, generation_uid=None, **kw)
Take the root element of the document, and scan its attributes under the assumption it is an XMLSchema schema element.
source code
Class Variables [hide private]
  __annotations = None
hash(x)
  __pastProlog = False
  __location = None
hash(x)
  __locationTag = None
hash(x)
  __signature = None
hash(x)
  __generationUID = None
hash(x)
  __originRecord = None
hash(x)
  __targetNamespace = None
hash(x)
  __defaultNamespace = None
hash(x)
  __referencedNamespaces = None
hash(x)
  __namespaceData = None
hash(x)
  __importEIIs = None
hash(x)
  __importedSchema = None
hash(x)
  __includedSchema = None
hash(x)
  _QUALIFIED = 'qualified'
  _UNQUALIFIED = 'unqualified'
  __attributeMap = {pyxb.namespace.ExpandedName(None, 'attribute...
  __SchemaCategories = ('typeDefinition', 'attributeGroupDefinit...
  __uriContentArchiveDirectory = None
hash(x)
  __TopLevelComponentMap = {'attribute': <class 'pyxb.xmlschema....
  _SA_All = '#all'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__getstate__(self)

source code 
Overrides: utils.utility.PrivateTransient_mixin.__getstate__

location(self)

source code 

URI or path to where the schema can be found.

For schema created by a user, the location should be provided to the constructor using the schema_location keyword. In the case of imported or included schema, the including schema's location is used as the base URI for determining the absolute URI of the included schema from its (possibly relative) location value. For files, the scheme and authority portions are generally absent, as is often the abs_path part.

targetNamespace(self)

source code 

The targetNamespace of a componen.

This is None, or a reference to a Namespace in which the component is declared (either as a global or local to one of the namespace's complex type definitions). This is immutable after creation.

defaultNamespace(self)

source code 

Default namespace of the schema.

Will be None unless the schema has an 'xmlns' attribute. The value must currently be provided as a keyword parameter to the constructor.

schemaAttribute(self, attr_name)

source code 

Return the schema attribute value associated with the given (nc)name.

Parameters:
  • attr_name - local name for the attribute in the schema element.
Returns:
the value of the corresponding attribute, or None if it has not been defined and has no default.
Raises:
  • KeyError - attr_name is not a valid attribute for a schema element.

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

CreateFromLocation(cls, **kw)
Class Method

source code 

Create a schema from a schema location.

Reads an XML document from the schema location and creates a schema using it. All keyword parameters are passed to CreateFromDOM.

Parameters:
  • schema_location - A file path or a URI. If this is a relative URI and parent_uri is present, the actual location will be normallzed.
  • parent_uri - The context within which schema_location will be normalized, if necessary.
  • absolute_schema_location - A file path or URI. This value is not normalized, and supersedes schema_location.

CreateFromDOM(cls, node, namespace_context=None, schema_location=None, schema_signature=None, generation_uid=None, **kw)
Class Method

source code 

Take the root element of the document, and scan its attributes under the assumption it is an XMLSchema schema element. That means recognize namespace declarations and process them. Also look for and set the default namespace. All other attributes are passed up to the parent class for storage.

blockForNode(self, dom_node, candidate_map)

source code 

Return a bit mask indicating a set of options read from the node's "block" attribute or the schema's "blockDefault" attribute.

A value of '#all' means enable every options; otherwise, the attribute value should be a list of tokens, for which the corresponding value will be added to the return value.

Parameters:
  • dom_node (xml.dom.Node) - the node from which the "block" attribute will be retrieved
  • candidate_map - map from strings to bitmask values

finalForNode(self, dom_node, candidate_map)

source code 

Return a bit mask indicating a set of options read from the node's "final" attribute or the schema's "finalDefault" attribute.

A value of '#all' means enable every options; otherwise, the attribute value should be a list of tokens, for which the corresponding value will be added to the return value.

Parameters:
  • dom_node (xml.dom.Node) - the node from which the "final" attribute will be retrieved
  • candidate_map - map from strings to bitmask values

targetNamespaceForNode(self, dom_node, declaration_type)

source code 

Determine the target namespace for a local attribute or element declaration.

Look at the node's form attribute, or if none the schema's attributeFormDefault or elementFormDefault value. If the resulting value is "qualified" and the parent schema has a non-absent target namespace, return it to use as the declaration target namespace. Otherwise, return None to indicate that the declaration has no namespace.

Parameters:
Returns:
pyxb.namespace.Namespace or None

__processImport(self, node)

source code 

Process an import directive.

This attempts to locate schema (named entity) information for a namespace that is referenced by this schema.

__processTopLevelNode(self, node)

source code 

Process a DOM node from the top level of the schema.

This should return a non-None value if the node was successfully recognized.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

Class Variable Details [hide private]

__attributeMap

Value:
{pyxb.namespace.ExpandedName(None, 'attributeFormDefault'): _UNQUALIFI\
ED, pyxb.namespace.ExpandedName(None, 'elementFormDefault'): _UNQUALIF\
IED, pyxb.namespace.ExpandedName(None, 'blockDefault'): '', pyxb.names\
pace.ExpandedName(None, 'finalDefault'): '', pyxb.namespace.ExpandedNa\
me(None, 'id'): None, pyxb.namespace.ExpandedName(None, 'targetNamespa\
ce'): None, pyxb.namespace.ExpandedName(None, 'version'): None, pyxb.n\
amespace.XML.createExpandedName('lang'): None}

__SchemaCategories

Value:
('typeDefinition',
 'attributeGroupDefinition',
 'modelGroupDefinition',
 'attributeDeclaration',
 'elementDeclaration',
 'notationDeclaration',
 'identityConstraintDefinition')

__TopLevelComponentMap

Value:
{'attribute': <class 'pyxb.xmlschema.structures.AttributeDeclaration'>\
,
 'attributeGroup': <class 'pyxb.xmlschema.structures.AttributeGroupDef\
inition'>,
 'complexType': <class 'pyxb.xmlschema.structures.ComplexTypeDefinitio\
n'>,
 'element': <class 'pyxb.xmlschema.structures.ElementDeclaration'>,
 'group': <class 'pyxb.xmlschema.structures.ModelGroupDefinition'>,
...