• Home
  • Raw
  • Download

Lines Matching refs:XML

1 :mod:`xml.etree.ElementTree` --- The ElementTree XML API
44 convert it from and to XML.
64 XML tree and elements
67 XML is an inherently hierarchical data format, and the most natural way to
69 :class:`ElementTree` represents the whole XML document as a tree, and
72 on the :class:`ElementTree` level. Interactions with a single XML element
77 Parsing XML
80 We'll be using the following XML document as the sample data for this section:
118 :func:`fromstring` parses XML from a string directly into an :class:`Element`,
176 Modifying an XML File
179 :class:`ElementTree` provides a simple way to build XML documents and write them to files.
197 Our XML now looks like this:
235 Our XML now looks like this:
256 Building XML documents
269 Parsing XML with Namespaces
272 If the XML input has `namespaces
280 Here is an XML example that incorporates two namespaces, one with the
301 One way to search and explore this XML example is to manually add the
313 A better way to search the namespaced XML example is to create a
356 module. We'll be using the ``countrydata`` XML document from the
357 :ref:`Parsing XML <elementtree-parsing-xml>` section::
442 that will be serialized as an XML comment by the standard serializer. The
454 written as an ordinary XML file.
461 Parses an XML section from a string constant. Same as :func:`XML`. *text*
462 is a string containing XML data. Returns an :class:`Element` instance.
467 Parses an XML document from a sequence of string fragments. *sequence* is a
468 list or other sequence containing XML data fragments. *parser* is an
483 Parses an XML section into an element tree incrementally, and reports what's
484 going on to the user. *source* is a filename or file object containing XML
504 Parses an XML section into an element tree. *source* is a filename or file
505 object containing XML data. *parser* is an optional parser instance. If
513 will be serialized as an XML processing instruction. *target* is a string
543 Generates a string representation of an XML element, including all
547 containing the XML data.
552 Generates a string representation of an XML element, including all
556 strings containing the XML data. It does not guarantee any specific
563 .. function:: XML(text, parser=None)
565 Parses an XML section from a string constant. This function can be used to
566 embed "XML literals" in Python code. *text* is a string containing XML
573 Parses an XML section from a string constant, and also returns a dictionary
574 which maps from element id:s to elements. *text* is a string containing XML
608 an XML file, the *text* attribute holds either the text between
611 end tag and the next tag, or ``None``. For the XML data
789 standard XML.
792 of the XML *file* if given.
846 Loads an external XML section into this element tree. *source* is a file
855 Writes the element tree to a file, as XML. *file* is a file name, or a
857 (default is US-ASCII). *xml_declaration* controls if an XML declaration
860 sets the default XML namespace (for "xmlns"). *method* is either
864 This is the XML file that is going to be manipulated::
919 can use this class to build an element structure using a custom XML parser,
920 or a parser for some other XML-like format. The *element_factory* is called
968 :class:`Element` structure builder for XML source data, based on the expat
973 XML file.
997 This is an example of counting the maximum depth of an XML file::
1034 .. [1] The encoding string included in XML output should conform to the