present – Screen output of XML trees

This module contains presenter classes, which are used for formatting XIST trees into various formats.

class ll.xist.present.CodePresenter(node, indent=None)[source]

Bases: ll.xist.present.Presenter

This presenter formats the object as a nested Python object tree.

This makes it possible to quickly convert HTML/XML files to XIST constructor calls.

__init__(node, indent=None)[source]

Create a CodePresenter object for the XIST node node using indent for indenting each tree level. If indent is None use the value of the environment variable LL_XIST_INDENT as the indent string (falling back to a tab if the environment variable doesn’t exist).

class ll.xist.present.Presenter(node)[source]

Bases: object

This class is the base of the presenter classes. It is abstract and only serves as documentation for the methods.

A Presenter generates a specific string representation of a node to be printed on the screen.

presentAttr(node)[source]

Present an ll.xist.xsc.Attr node.

presentAttrs(node)[source]

Present an ll.xist.xsc.Attrs node.

presentComment(node)[source]

Present a ll.xist.xsc.Comment node.

presentDocType(node)[source]

Present a ll.xist.xsc.DocType node.

presentElement(node)[source]

Present an ll.xist.xsc.Element node.

presentEntity(node)[source]

Present a ll.xist.xsc.Entity node.

presentFrag(node)[source]

Present a ll.xist.xsc.Frag node.

presentNull(node)[source]

Present the ll.xist.xsc.Null node.

presentProcInst(node)[source]

Present a ll.xist.xsc.ProcInst node.

presentText(node)[source]

Present a ll.xist.xsc.Text node.

class ll.xist.present.TreePresenter(node, indent=None, defaultxmlns=None)[source]

Bases: ll.xist.present.Presenter

This presenter shows the object as a nested tree.

__init__(node, indent=None, defaultxmlns=None)[source]

Create a TreePresenter object for the XIST node node using indent for indenting each tree level. If indent is None use the value of the environment variable LL_XIST_INDENT as the indent string (falling back to a tab if the environment variable doesn’t exist).

If defaultxmlns is not None, elements from this namespace will be output without any namespace name.