Package pyxb |
[hide private]
[frames] | no frames]

# Package pyxb

source code

PyXB stands for Python W3C XML Schema Bindings, and is pronounced "pixbee". It enables translation between XML instance documents and Python objects following rules specified by an XML Schema document.

This is the top-level entrypoint to the PyXB system. Importing this gets you all the exceptions, and pyxb.namespace. For more functionality, delve into these submodules:

- pyxb.xmlschema Module holding the structures that convert XMLSchema from a DOM model to a Python class model based on the XMLSchema components. Use this when you need to operate on the component model.
- pyxb.binding Module used to generate the bindings and at runtime to support the generated bindings. Use this if you need to use the binding model or content model.
- pyxb.utils Common utilities used in parsing, generating, and executing. The submodules must be imported separately.

Version: 1.2.3

License: Apache License 2.0

Submodules | [hide private]
pyxb.binding: Material used to generate and execute bindings generated by the PyXB package. pyxb.binding.basis: This module contains support classes from which schema-specific bindings inherit, and that describe the content models of those schema. pyxb.binding.content: Helper classes that maintain the content model of XMLSchema in the binding classes. pyxb.binding.datatypes: Classes supporting XMLSchema Part 2: Datatypes. pyxb.binding.facets: Classes related to XMLSchema facets. pyxb.binding.generate: The really ugly code that generates the Python bindings. pyxb.binding.saxer: This module contains support for generating bindings from an XML stream using a SAX parser. pyxb.binding.xml_: Binding classes for types referenced by the attribute and attribute group declarations in the XML namespace (http://www.w3.org/XML/1998/namespace). pyxb.exceptions_: Extensions of standard exceptions for PyXB events. pyxb.namespace: Classes and global objects related to XML Namespaces. pyxb.namespace.archive: Classes and global objects related to archiving XML Namespaces. pyxb.namespace.builtin: Classes and global objects related to built-in XML Namespaces. pyxb.namespace.resolution: Classes and global objects related to resolving XML Namespaces. pyxb.namespace.utility: Utility functions related to XML Namespaces. pyxb.utils: pyxb.utils -- Utilities for the PyWXSB package. pyxb.utils.activestate pyxb.utils.domutils: Functions that support activities related to the Document Object Model. pyxb.utils.fac: This module provides Finite Automata with Counters. pyxb.utils.saxdom: This module contains support for a DOM tree representation from an XML document using a SAX parser. pyxb.utils.saxutils: This module contains support for processing XML using a SAX parser. pyxb.utils.templates: Functions that aid with generating text from templates and maps. pyxb.utils.types_: This module provides references to built-in Python types. pyxb.utils.unicode: This module contains support for Unicode characters as required to support the regular expression syntax defined in annex F of the XML Schema definition. pyxb.utils.unicode_data pyxb.utils.utility: Utility functions and classes. pyxb.utils.xmlre: Support for regular expressions conformant to the XML Schema specification. pyxb.xmlschema: XMLSchema -- Classes to support processing W3C XML Schema definitions. pyxb.xmlschema.structures: Classes corresponding to W3C XML Schema components.

Classes | [hide private]
BIND Bundle data for automated binding generation.
ValidationConfig Class holding configuration related to validation.
cscRoot This little bundle of joy exists because in Python 2.6 it became an error to invoke `object.__init__` with parameters (unless you also override `__new__`, in which case it's only a warning.

Functions | [hide private]
NonElementContent(instance) Return an iterator producing the non-element content of the provided instance. | source code
PreserveInputTimeZone(value=None) Control whether time values are converted to UTC during input. | source code
RequireValidWhenGenerating(value=None) Query or set a flag that controls validation checking in XML generation. | source code
RequireValidWhenParsing(value=None) Query or set a flag that controls validation checking in XML parsing. | source code
_SetXMLStyle(style=None) Set the interface used to parse XML content. | source code

Variables | [hide private]
| GlobalValidationConfig = `pyxb.GlobalValidationConfig`
| XMLStyle_minidom = `0`
| XMLStyle_saxdom = `1`
| XMLStyle_saxer = `2`
| _CorruptionDetectionEnabled = `True`
| _GenerationRequiresValid = `True`
| _InputEncoding = ``'``utf-8``'``
| _OptimizationActive = `False`
| _OutputEncoding = ``'``utf-8``'``
| _ParsingRequiresValid = `True`
| _PreserveInputTimeZone = `False`
| _XMLStyle = `2`
| _XMLStyleMap = ``{``'``minidom``'``:` 0`,` `'``saxdom``'``:` 1`,` `'``saxer``'``:` 2`}``
| _XMLStyleMapReverse = ``{`0`:` `'``minidom``'``,` 1`:` `'``saxdom``'``,` 2`:` `'``saxer``'``}``
| _XMLStyle_envvar = ``'``PYXB_XML_STYLE``'``
| __package__ = ``'``pyxb``'``
| __url__ = ``'``http://pyxb.sourceforge.net``'``
| _k = ``'``saxdom``'``
| _log = `<logging.Logger object at 0x1ddfed0>`
| _v = `1`

Function Details | [hide private]

### NonElementContent(instance) | source code
Return an iterator producing the non-element content of the provided instance. The catenated text of the non-element content of an instance can be obtained with:
      text = u''.join(pyxb.NonElementContent(instance))
Parameters: `instance` - An instance of pyxb.binding.basis.complexTypeDefinition. Returns: an iterator producing text values

### PreserveInputTimeZone(value=None) | source code
Control whether time values are converted to UTC during input. The specification makes clear that timezoned times are in UTC and that times in other timezones are to be translated to UTC when converted from literal to value form. Provide an option to bypass this step, so the input timezone is preserved. Note: Naive processing of unnormalized times--i.e., ignoring the `tzinfo` field--may result in errors.

### RequireValidWhenGenerating(value=None) | source code
Query or set a flag that controls validation checking in XML generation. Normally any attempts to convert a binding instance to a DOM or XML representation requires that the binding validate against the content model, since only in this way can the content be generated in the correct order. In some cases it may be necessary or useful to generate a document from a binding that is incomplete. If validation is not required, the generated documents may not validate even if the content validates, because ordering constraints will be ignored. Parameters: `value` (`bool`) - If absent or `None`, no change is made; otherwise, this enables (`True`) or disables (`False`) the requirement that instances validate before being converted to XML. Returns: `True` iff attempts to generate XML for a binding that does not validate should raise an exception.

### RequireValidWhenParsing(value=None) | source code
Query or set a flag that controls validation checking in XML parsing. Normally any attempts to convert XML to a binding instance to a binding instance requires that the document validate against the content model. In some cases it may be necessary or useful to process a document that is incomplete. If validation is not required, the generated documents may not validate even if the content validates, because ordering constraints will be ignored. Parameters: `value` (`bool`) - If absent or `None`, no change is made; otherwise, this enables (`True`) or disables (`False`) the requirement that documents validate when being converted to bindings. Returns: `True` iff attempts to generate bindings for a document that does not validate should raise an exception.

### _SetXMLStyle(style=None) | source code
Set the interface used to parse XML content. This can be invoked within code. The system default of XMLStyle_saxer can also be overridden at runtime by setting the environment variable `PYXB_XML_STYLE` to one of `minidom`, `saxdom`, or `saxer`. Parameters: `style` - One of XMLStyle_minidom, XMLStyle_saxdom, XMLStyle_saxer. If not provided, the system default is used.