XmlParser¶
- class dictIO.parser.XmlParser(*, add_node_numbering: bool = True)¶
Bases:
Parser
Parser to deserialize a string in XML format into a SDict.
- __init__(*, add_node_numbering: bool = True) None ¶
Define default configuration for XmlParser.
Methods
__init__
(*[, add_node_numbering])Define default configuration for XmlParser.
get_parser
([source_file])Return a Parser instance matching the type of the source file to be parsed (factory method).
parse_file
(source_file[, target_dict, comments])Parse a file and deserialize it into a dict.
parse_key
(arg)Parse a single key.
parse_string
(string, target_dict, *[, comments])Parse a string in XML format and deserialize it into a SDict.
parse_value
(arg)Parse a single value.
parse_values
(arg)Parse multiple values.
remove_quotes_from_string
(arg, *[, all_quotes])Remove quotes from a string.
remove_quotes_from_strings
(arg)Remove quotes from multiple strings.
- parse_string(string: str, target_dict: SDict[K, V], *, comments: bool = True) SDict[K, V] ¶
Parse a string in XML format and deserialize it into a SDict.
- Parameters:
string (str) – the string to be parsed (i.e. the content of the file that had been read using parse_file())
target_dict (SDict[K, V]) – the target dict the parsed dict file shall be merged into
comments (bool, optional) – reads comments, by default True
- Returns:
the parsed dict
- Return type:
SDict[K, V]