xl¶
xml without mess.
This is a Python module to process XML.
Why I am coding this?¶
- lxml supports sub text node not clear enough.
- xml.etree.ElementTree doesn’t care XML namespaces.
- I want to learn XML.
-
epubaker.xl.parse(xmlstr, debug=False)¶ parse XML string to Xl object
Parameters: - xmlstr (str) –
- debug (bool) –
Returns: object of
XlReturn type:
-
epubaker.xl.clean_whitespaces(element)¶ Parameters: element – Returns: A copy of the element, all whitespace characters have been stripped from the beginning and the end of the text node in the children and children’s children and so on. delete the text node If it is empty.
-
epubaker.xl.pretty_insert(element, start_indent=0, step=4, dont_do_when_one_child=True)¶ Modify the copy of the element, to make it looks more pretty and clear.
Parameters: - element (Element) –
- start_indent (int) –
- step (int) –
- dont_do_when_one_child (bool) –
Returns: object of
Element
-
class
epubaker.xl.Header(version=None, encoding=None, standalone=None)¶ Handle XML header node
Parameters: - version (str) –
- encoding (str) –
- standalone (bool) –
-
class
epubaker.xl.DocType(doc_type_name, system_id, public_id)¶ Handle XML doc type node