pyhpecw7.utils.xml.lib module¶
This module provides several utility functions
for dealing with XML text and etree.Element
XML objects.
-
pyhpecw7.utils.xml.lib.
config_params
(pmap, key_map, value_map={}, E=<lxml.builder.ElementMaker object>, fill_in=True)[source]¶
-
pyhpecw7.utils.xml.lib.
elem_to_dict
(elem, ns, key_map, value_map={})[source]¶ Convert an XML etree.Element to a desired dictionary as specified by the key map and value map. :param elem: An ancestor element
of the tags specified in the key map.Parameters: - ns (string) – The namespace to use when searching for XML tags.
- key_map (dict) – A mapping from desired dictionary keys to XML tag names.
- value_map (dict) – A mapping from XML tag names to dictionaries of mappings from XML text values to desired dictionary values.
Returns: The desired dictionary.
-
pyhpecw7.utils.xml.lib.
get_text
(xml, tag)[source]¶ Return the text from a given tag and XML element.