Developer Interfaces#

Main Interfaces#

Those functions are publicly exposed and are protected through our BC guarantee.

dicttoxml2.dicttoxml(obj: ~typing.Any, root: bool = True, custom_root: str = 'root', ids: bool = False, attr_type: bool = True, item_func: ~typing.Callable[[~typing.Any], str] = <function default_item_func>, cdata: bool = False, fold_list: bool = True) bytes[source]#

Converts a python object into XML. Arguments: - root specifies whether the output is wrapped in an XML root element

Default is True

  • custom_root allows you to specify a custom root element. Default is ‘root’

  • ids specifies whether elements get unique ids. Default is False

  • attr_type specifies whether elements get a data type attribute. Default is True

  • item_func specifies what function should generate the element name for items in a list. Default is ‘item’

  • cdata specifies whether string values should be wrapped in CDATA sections. Default is False

  • fold_list when using the option fold_list=False the parameter item_func is ignored. In case of nested lists, all list entries will use the same parent dictionary name as item name. Default is True