• Home
  • Raw
  • Download

Lines Matching refs:XML

1 :mod:`xml.etree.ElementTree` --- The ElementTree XML API
14 for parsing and creating XML data.
36 XML tree and elements
39 XML is an inherently hierarchical data format, and the most natural way to
41 :class:`ElementTree` represents the whole XML document as a tree, and
44 on the :class:`ElementTree` level. Interactions with a single XML element
49 Parsing XML
52 We'll be using the following XML document as the sample data for this section:
90 :func:`fromstring` parses XML from a string directly into an :class:`Element`,
118 Not all elements of the XML input will end up as elements of the
119 parsed tree. Currently, this module skips over any XML comments,
122 than parsing from XML text can have comments and processing
123 instructions in them; they will be included when generating XML
138 most needs. Sometimes what the user really wants is to be able to parse XML
143 require a blocking read to obtain the XML data, and is instead fed with data
144 incrementally with :meth:`XMLPullParser.feed` calls. To get the parsed XML
159 where the XML data is being received from a socket or read incrementally from
163 simpler use-cases. If you don't mind your application blocking on reading XML
165 at :func:`iterparse`. It can be useful when you're reading a large XML document
201 Modifying an XML File
204 :class:`ElementTree` provides a simple way to build XML documents and write them to files.
222 Our XML now looks like this:
266 Our XML now looks like this:
287 Building XML documents
300 Parsing XML with Namespaces
303 If the XML input has `namespaces
311 Here is an XML example that incorporates two namespaces, one with the
332 One way to search and explore this XML example is to manually add the
343 A better way to search the namespaced XML example is to create a
387 module. We'll be using the ``countrydata`` XML document from the
388 :ref:`Parsing XML <elementtree-parsing-xml>` section::
410 For XML with namespaces, use the usual qualified ``{namespace}tag`` notation::
511 Canonicalization is a way to normalise XML output in a way that allows
513 that XML serializers have and instead generates a more constrained XML
517 This function takes an XML data string (*xml_data*) or a file path or
558 that will be serialized as an XML comment by the standard serializer. The
574 written as an ordinary XML file.
585 Parses an XML section from a string constant. Same as :func:`XML`. *text*
586 is a string containing XML data. *parser* is an optional parser instance.
593 Parses an XML document from a sequence of string fragments. *sequence* is a
594 list or other sequence containing XML data fragments. *parser* is an
604 This can be used to generate pretty-printed XML output.
621 Parses an XML section into an element tree incrementally, and reports what's
623 containing XML data. *events* is a sequence of events to report back. The
657 Parses an XML section into an element tree. *source* is a filename or file
658 object containing XML data. *parser* is an optional parser instance. If
666 will be serialized as an XML processing instruction. *target* is a string
703 Generates a string representation of an XML element, including all
710 containing the XML data.
727 Generates a string representation of an XML element, including all
734 strings containing the XML data. It does not guarantee any specific sequence,
750 .. function:: XML(text, parser=None)
752 Parses an XML section from a string constant. This function can be used to
753 embed "XML literals" in Python code. *text* is a string containing XML
760 Parses an XML section from a string constant, and also returns a dictionary
761 which maps from element id:s to elements. *text* is a string containing XML
778 Here's an example that demonstrates use of the XInclude module. To include an XML document in the c…
893 an XML file, the *text* attribute holds either the text between
896 end tag and the next tag, or ``None``. For the XML data
1065 Prior to Python 3.8, the serialisation order of the XML attributes of
1072 attributes, given that the `XML Information Set
1075 any ordering on input. In cases where deterministic XML output is required,
1106 standard XML.
1109 of the XML *file* if given.
1155 Loads an external XML section into this element tree. *source* is a file
1165 Writes the element tree to a file, as XML. *file* is a file name, or a
1168 *xml_declaration* controls if an XML declaration should be added to the
1171 *default_namespace* sets the default XML namespace (for "xmlns").
1194 This is the XML file that is going to be manipulated::
1251 a custom XML parser, or a parser for some other XML-like format.
1355 :mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It can
1356 be fed XML data incrementally with the :meth:`feed` method, and parsing
1360 encoding specified in the XML file.
1384 of an XML file::
1487 XML parse error, raised by the various parsing methods in this module when
1503 .. [1] The encoding string included in XML output should conform to the