Element¶
A generic file/XML node element.
It can be created by programmatically populating its instance variables, or by parsing a string or an XML node object.
This class is “abstract”,
assigning the task of implementing
the abstract function
yael.element.Element.parse_object()
to each concrete subclass,
according to the suitable element semantics.
-
class
yael.element.
Element
(internal_path=None, obj=None, string=None)[source]¶ Build a generic file/XML element, or parse it from obj or string.
Parameters: - internal_path (str) – a string representing the path of the element inside the (possibly, virtual) EPUB container
- obj (object) – an XML (lxml) node object to be parsed to build this Element
- string (str) – a string to be parsed to build this Element
-
asset
¶ The asset associated with this element.
Return type: yael.asset.Asset
-
contents
¶ The contents of the associated asset.
Return type: bytes
-
internal_path
¶ A string representing the path of the element inside the (possibly, virtual) EPUB Container. It should be None for elements not representing files inside the EPUB Container.
Return type: str