loads xml data to dict from a string

loading a string

Loads xml string data, and returns data as a dictionary.

maci.xmlloadstrdict -> dict[str, Any]

Basic Example of loading a xml string using default positional parameter

data = maci.xmlloadstrdict('<mydata><data1>one</data1></mydata>')

In this example, we simply load xml data from a string using the xmlloadstrdict function and pass a string as an argument to the function to load the xml data, and assign the returned data to a variable.

Access data as you normally would with a dictionary in python.

Note: All values in xml data are returned as strings.

partner functions

Functions that are related for xml as dict

maci.xmlloaddict -> Loads xml data from a file as dict maci.xmldumpdict -> Dumps xml data to a file from dict maci.xmldumpstrdict -> Dumps xml data to a string from dict

parameters & arguments

Describes all parameter functionality and accepted data types

xml_str_data: str

First and only required positional argument. Accepts strings

Use this parameter to pass in your xml formatted string data

This function uses the xmltodict library installed as a dependency from pypi for its underlying functionality. For more information on xmltodict, visit:

Security awareness: It is important to evaluate handling XML data carefully as there are known vulnerabilities in dealing with XML data. Please refer to the official python documentation.

Last updated