# maci.xmlloadstr

### loading a string

Loads xml string data, and returns an [Element](https://docs.python.org/3/library/xml.etree.elementtree.html#module-xml.etree.ElementTree) object.

{% hint style="info" %}
maci.xmlloadstr  ->  [Element](https://docs.python.org/3/library/xml.etree.elementtree.html#module-xml.etree.ElementTree)
{% endhint %}

*Basic Example of loading a xml string using default positional parameter*

```python
data = maci.xmlloadstr('<mydata><data1>one</data1></mydata>')
```

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

\
\&#xNAN;*Basic Example of accessing element data*

```python
data.find('data1').text
```

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

\
More information on using Element and ElementTree data:\
Youtube Video Search: <https://www.youtube.com/results?search_query=python+xml+etree>\
Documentation: <https://docs.python.org/3/library/xml.etree.elementtree.html>

### partner functions

Functions that are related for ElementTree

[maci.xmlload](https://docs.macilib.org/docs/xml/functions/maci.xmlload)  ->  Loads xml data from a file as Element or ElementTree object\
[maci.xmldump](https://docs.macilib.org/docs/xml/functions/maci.xmldump)  ->  Dumps xml data to a file from xml etree ElementTree or Element object\
[maci.xmldumpstr](https://docs.macilib.org/docs/xml/functions/maci.xmldumpstr)  ->  Dumps xml data to a string from xml etree Element object\
[maci.xmlbuildmanual](https://docs.macilib.org/docs/xml/functions/maci.xmlbuildmanual)  ->  Returns empty xml ElementTree object to manually build xml data\
[maci.\_defuse\_xml\_stdlib](https://docs.macilib.org/docs/xml/functions/maci._defuse_xml_stdlib)  ->  Monkey patch and defuse all stdlib packages \[security use]

### parameters & arguments

Describes all parameter functionality and accepted data types

<details>

<summary>xml_str_data:  str</summary>

First and only required positional argument. Accepts strings

Use this parameter to pass in your xml formatted string data

</details>

*This function uses the native xml library etree shipped with the python standard library for its underlying functionality. For more information on the xml.etree api, visit:* [*https://docs.python.org/3/library/xml.etree.elementtree.html*](https://docs.python.org/3/library/xml.etree.elementtree.html)

**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 above.

Additionally, see the provided tooling to potentially assist with vulnerabilities [\_defuse\_xml\_stdlib](https://docs.macilib.org/docs/xml/functions/maci._defuse_xml_stdlib)
