Base Parser¶
Base class of parsers.
- class benker.parsers.base_parser.BaseParser(builder, encoding='utf-8', **options)¶
Bases:
object
Abstract base class of the parsers classes.
- parse_file(src_xml, dst_xml)¶
Parse and convert the tables from one format to another.
- transform_tables(tree)¶
- benker.parsers.base_parser.value_of(element, xpath, namespaces=None, default=None)¶
Take the first value of a xpath evaluation.
- Parameters
element (etree._Element) – Root element used to evaluate the xpath expression.
xpath (str) – xpath expression. This expression will be evaluated using the namespaces namespaces.
namespaces (dict[str, str]) – Namespace map to use for the xpath evaluation.
default – default value used if the xpath evaluation returns no result.
- Returns
the first result or the default value.