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.Presenter[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.

presentText(node)[source]

Present a ll.xist.xsc.Text node.

presentFrag(node)[source]

Present a ll.xist.xsc.Frag node.

presentComment(node)[source]

Present a ll.xist.xsc.Comment node.

presentDocType(node)[source]

Present a ll.xist.xsc.DocType node.

presentProcInst(node)[source]

Present a ll.xist.xsc.ProcInst node.

presentAttrs(node)[source]

Present an ll.xist.xsc.Attrs node.

presentElement(node)[source]

Present an ll.xist.xsc.Element node.

presentEntity(node)[source]

Present a ll.xist.xsc.Entity node.

presentNull(node)[source]

Present the ll.xist.xsc.Null node.

presentAttr(node)[source]

Present an ll.xist.xsc.Attr node.

class ll.xist.present.TreePresenter[source]

Bases: 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.

class ll.xist.present.CodePresenter[source]

Bases: 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).