Base XML Dumper¶
Note
Do not use the XML
directly.
dictdumper.xml
contains XML
only, which dumpers an extensible markup language (XML) format
file. Usage sample is described as below.
>>> dumper = XML(file_name)
>>> dumper(content_dict_1, name=content_name_1)
>>> dumper(content_dict_2, name=content_name_2)
............
Dumper class¶
-
class
dictdumper.xml.
XML
(fname, **kwargs)¶ Bases:
dictdumper.dumper.Dumper
Dump extensible markup language (XML) file.
Note
This is a base dumper for XML format. No
dtd
supported.>>> dumper = XML(file_name) >>> dumper(content_dict_1, name=content_name_1) >>> dumper(content_dict_2, name=content_name_2) ............
- Variables
_file (str) – output file name
_sptr (
int
, file pointer) – indicates start of appending point_tctr (int) – tab level counter
_hsrt (str) – start string (
_HEADER_START
)_hend (str) – end string (
_HEADER_END
)
-
__type__
= ()¶ Type codes.
- Type
Tuple[Tuple[type, str]]
-
_tctr
= 1¶ Tab level counter.
- Type
int
-
_hsrt
= '<?xml version="1.0" encoding="UTF-8"?>\n<content>\n'¶ XML head string.
-
_hend
= '</content>\n'¶ XML tail string.
-
property
kind
¶ str
: File format of current dumper.
-
abstract
_append_value
(value, file, name)¶ Call this function to write contents.
- Parameters
value (
Dict[str, Any]
) – content to be dumpedfile (
file
object) – output filename (str) – name of current content block