MCPcopy Index your code
hub / github.com/python/cpython / XML

Function XML

Lib/xml/etree/ElementTree.py:1343–1357  ·  view source on GitHub ↗

Parse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance.

(text, parser=None)

Source from the content-addressed store, hash-verified

1341
1342
1343def XML(text, parser=None):
1344 """Parse XML document from string constant.
1345
1346 This function can be used to embed "XML Literals" in Python code.
1347
1348 *text* is a string containing XML data, *parser* is an
1349 optional parser instance, defaulting to the standard XMLParser.
1350
1351 Returns an Element instance.
1352
1353 """
1354 if not parser:
1355 parser = XMLParser(target=TreeBuilder())
1356 parser.feed(text)
1357 return parser.close()
1358
1359
1360def XMLID(text, parser=None):

Callers

nothing calls this directly

Calls 4

feedMethod · 0.95
closeMethod · 0.95
XMLParserClass · 0.85
TreeBuilderClass · 0.85

Tested by

no test coverage detected