The elementtree.ElementInclude Module

Limited XInclude support for the ElementTree package.

Module Contents

default_loader(href, parse, encoding=None) [#]

Default loader. This loader reads an included resource from disk.

href
Resource reference.
parse
Parse mode. Either "xml" or "text".
encoding
Optional text encoding.
Returns:
The expanded resource. If the parse mode is "xml", this is an ElementTree instance. If the parse mode is "text", this is a Unicode string. If the loader fails, it can return None or raise an IOError exception.
Raises IOError:
If the loader fails to load the resource.

FatalIncludeError (class) [#]

Fatal include error.

For more information about this class, see The FatalIncludeError Class.

include(elem, loader=None) [#]

Expand XInclude directives.

elem
Root element.
loader
Optional resource loader. If omitted, it defaults to default_loader. If given, it should be a callable that implements the same interface as default_loader.
Raises FatalIncludeError:
If the function fails to include a given resource, or if the tree contains malformed XInclude elements.
Raises IOError:
If the function fails to load a given resource.

The FatalIncludeError Class

FatalIncludeError (class) [#]

Fatal include error.