@staticmethod<EOL><INDENT>def to_etree(xml):<DEDENT>
if isinstance(xml, OneLogin_Saml2_XML._element_class):<EOL><INDENT>return xml<EOL><DEDENT>if isinstance(xml, OneLogin_Saml2_XML._bytes_class):<EOL><INDENT>return OneLogin_Saml2_XML._parse_etree(xml, forbid_dtd=True)<EOL><DEDENT>if isinstance(xml, OneLogin_Saml2_XML._text_class):<EOL><INDENT>return OneLogin_Saml2_XML._parse_etree(compat.to_bytes(xml), forbid_dtd=True)<EOL><DEDENT>raise ValueError('<STR_LIT>' % type(xml))<EOL>
Parses an XML document or fragment from a string.
:param xml: the string to parse
:type xml: str|bytes|xml.dom.minidom.Document|etree.Element
:returns: the root node
:rtype: OneLogin_Saml2_XML._element_class