'Parses the given XML file or string into an element structure.
The ``source`` can either be a path to an XML file or a string
containing XML. In both cases the XML is parsed into ElementTree
[http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element|element structure]
and the root element is returned. Possible comments and processing
instructions in the source XML are removed.
As discussed in `Handling XML namespaces` section, this keyword, by
default, removes namespace information ElementTree has added to tag
names and moves it into ``xmlns`` attributes. This typically eases
handling XML documents with namespaces considerably. If you do not
want that to happen, or want to avoid the small overhead of going
through the element structure when your XML does not have namespaces,
you can disable this feature by giving ``keep_clark_notation`` argument
a true value (see `Boolean arguments`).
If you want to strip namespace information altogether so that it is
not included even if XML is saved, you can give a true value to
``strip_namespaces`` argument. This functionality is new in Robot
Framework 3.0.2.
Examples:
| ${root} = | Parse XML | <root><child/></root> |
| ${xml} = | Parse XML | ${CURDIR}/test.xml | keep_clark_notation=True |
| ${xml} = | Parse XML | ${CURDIR}/test.xml | strip_namespaces=True |
Use `Get Element` keyword if you want to get a certain element and not
the whole structure. See `Parsing XML` section for more details and
examples.'

def parse_xml(self, source, keep_clark_notation=False, strip_namespaces=False):

    with ETSource(source) as source:
        tree = self.etree.parse(source)
    if self.lxml_etree:
        strip = (lxml_etree.Comment, lxml_etree.ProcessingInstruction)
        lxml_etree.strip_elements(tree, *strip, **dict(with_tail=False))
    root = tree.getroot()
    if (not is_truthy(keep_clark_notation)):
        self._ns_stripper.strip(root, preserve=is_falsy(strip_namespaces))
    return root
