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:
objectThis class is the base of the presenter classes. It is abstract and only serves as documentation for the methods.
A
Presentergenerates a specific string representation of a node to be printed on the screen.- presentText(node)[source]
Present a
ll.xist.xsc.Textnode.
- presentFrag(node)[source]
Present a
ll.xist.xsc.Fragnode.
- presentComment(node)[source]
Present a
ll.xist.xsc.Commentnode.
- presentDocType(node)[source]
Present a
ll.xist.xsc.DocTypenode.
- presentProcInst(node)[source]
Present a
ll.xist.xsc.ProcInstnode.
- presentAttrs(node)[source]
Present an
ll.xist.xsc.Attrsnode.
- presentElement(node)[source]
Present an
ll.xist.xsc.Elementnode.
- presentEntity(node)[source]
Present a
ll.xist.xsc.Entitynode.
- presentNull(node)[source]
Present the
ll.xist.xsc.Nullnode.
- presentAttr(node)[source]
Present an
ll.xist.xsc.Attrnode.
- class ll.xist.present.TreePresenter[source]
Bases:
ll.xist.present.PresenterThis presenter shows the object as a nested tree.
- __init__(node, indent=None, defaultxmlns=None)[source]
Create a
TreePresenterobject for the XIST nodenodeusingindentfor indenting each tree level. IfindentisNoneuse the value of the environment variableLL_XIST_INDENTas the indent string (falling back to a tab if the environment variable doesn’t exist).If
defaultxmlnsis notNone, elements from this namespace will be output without any namespace name.
- class ll.xist.present.CodePresenter[source]
Bases:
ll.xist.present.PresenterThis 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
CodePresenterobject for the XIST nodenodeusingindentfor indenting each tree level. IfindentisNoneuse the value of the environment variableLL_XIST_INDENTas the indent string (falling back to a tab if the environment variable doesn’t exist).