chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33f2a42b-80c8-4c57-976c-6c2f27dd6af0 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,020 | supabase-export-v2 | 8022280b72278a2f | root = fromstring(xml_text) for actor in root.findall('{http://people.example.com}actor'): name = actor.find('{http://people.example.com}name') print(name.text) for char in actor.findall('{http://characters.example.com}character'): print(' |-->', char.text)
A better way to search the namespaced XML example is to create... | trusted_official_docs | CPython Docs | root = fromstring(xml_text) for actor in root.findall('{http://people.example.com}actor'): name = actor.find('{http://people.example.com}name') print(name.text) for char in actor.findall('{http://characters.example.com}character'): print(' |-->', char.text)
A better way to search the namespaced XML example is to create... | root = fromstring(xml_text) for actor in root.findall('{http://people.example.com}actor'): name = actor.find('{http://people.example.com}name') print(name.text) for char in actor.findall('{http://characters.example.com}character'): print(' |-->', char.text)
A better way to search the namespaced XML example is to create... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3428c1fe-0f26-433f-9b77-db7756a2a453 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,053 | supabase-export-v2 | 0176d78f40f0c49e | `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ transformation function.
Canonicalization is a way to normalise XML output in a way that allows
byte-by-byte comparisons and digital signatures. It reduces the freedom
that XML serializers have and instead generates a more constrained XML
representation. The main restri... | trusted_official_docs | CPython Docs | `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ transformation function.
Canonicalization is a way to normalise XML output in a way that allows
byte-by-byte comparisons and digital signatures. It reduces the freedom
that XML serializers have and instead generates a more constrained XML
representation. The main restri... | `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ transformation function.
Canonicalization is a way to normalise XML output in a way that allows
byte-by-byte comparisons and digital signatures. It reduces the freedom
that XML serializers have and instead generates a more constrained XML
representation. The main restri... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
377e37d3-a781-45ab-8a24-8f30cace1b34 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,064 | supabase-export-v2 | 2e1e2b3a397b5c5d | .. function:: Comment(text=None)
Comment element factory. This factory function creates a special element
that will be serialized as an XML comment by the standard serializer. The
comment string can be either a bytestring or a Unicode string. *text* is a
string containing the comment string. Returns an element insta... | trusted_official_docs | CPython Docs | .. function:: Comment(text=None)
Comment element factory. This factory function creates a special element
that will be serialized as an XML comment by the standard serializer. The
comment string can be either a bytestring or a Unicode string. *text* is a
string containing the comment string. Returns an element insta... | .. function:: Comment(text=None)
Comment element factory. This factory function creates a special element
that will be serialized as an XML comment by the standard serializer. The
comment string can be either a bytestring or a Unicode string. *text* is a
string containing the comment string. Returns an element insta... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
387fac78-fc97-44bc-b387-f4d09bf9b285 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,987 | supabase-export-v2 | 947a3ee177c72354 | what the user really wants is to be able to parse XML incrementally, without blocking operations, while enjoying the convenience of fully constructed :class:`Element` objects.
The most powerful tool for doing this is :class:`XMLPullParser`. It does not
require a blocking read to obtain the XML data, and is instead fed ... | trusted_official_docs | CPython Docs | what the user really wants is to be able to parse XML incrementally, without blocking operations, while enjoying the convenience of fully constructed :class:`Element` objects.
The most powerful tool for doing this is :class:`XMLPullParser`. It does not
require a blocking read to obtain the XML data, and is instead fed ... | what the user really wants is to be able to parse XML incrementally, without blocking operations, while enjoying the convenience of fully constructed :class:`Element` objects.
The most powerful tool for doing this is :class:`XMLPullParser`. It does not
require a blocking read to obtain the XML data, and is instead fed ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3dffebec-b02e-4b9a-8027-67b838c3fa08 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,000 | supabase-export-v2 | e706166e27e3864e | :class:`ElementTree` provides a simple way to build XML documents and write them to files. The :meth:`ElementTree.write` method serves this purpose.
Once created, an :class:`Element` object may be manipulated by directly changing
its fields (such as :attr:`Element.text`), adding and modifying attributes
(:meth:`Element... | trusted_official_docs | CPython Docs | :class:`ElementTree` provides a simple way to build XML documents and write them to files. The :meth:`ElementTree.write` method serves this purpose.
Once created, an :class:`Element` object may be manipulated by directly changing
its fields (such as :attr:`Element.text`), adding and modifying attributes
(:meth:`Element... | :class:`ElementTree` provides a simple way to build XML documents and write them to files. The :meth:`ElementTree.write` method serves this purpose.
Once created, an :class:`Element` object may be manipulated by directly changing
its fields (such as :attr:`Element.text`), adding and modifying attributes
(:meth:`Element... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f22c5ea-fee7-48dc-ab0e-b97d5a0e0c20 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,972 | supabase-export-v2 | d7648d6b73fdbed7 | direction="W"/> </country> <country name="Singapore"> <rank>4</rank> <year>2011</year> <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> <country name="Panama"> <rank>68</rank> <year>2011</year> <gdppc>13600</gdppc> <neighbor name="Costa Rica" direction="W"/> <neighbor name="Colombia" direction=... | trusted_official_docs | CPython Docs | direction="W"/> </country> <country name="Singapore"> <rank>4</rank> <year>2011</year> <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> <country name="Panama"> <rank>68</rank> <year>2011</year> <gdppc>13600</gdppc> <neighbor name="Costa Rica" direction="W"/> <neighbor name="Colombia" direction=... | direction="W"/> </country> <country name="Singapore"> <rank>4</rank> <year>2011</year> <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> <country name="Panama"> <rank>68</rank> <year>2011</year> <gdppc>13600</gdppc> <neighbor name="Costa Rica" direction="W"/> <neighbor name="Colombia" direction=... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3fafa4c1-42ce-4047-82b8-43da8f7ff31a | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,048 | supabase-export-v2 | 73083dc70bfa5812 | | | | | .. versionadded:: 3.10 | +-----------------------+------------------------------------------------------+ | ``[position]`` | Selects all elements that are located at the given | | | position.
The position can be either an integer |
| | (1 is the first position), the expression ``last()`` |
| | (for the last pos... | trusted_official_docs | CPython Docs | | | | | .. versionadded:: 3.10 | +-----------------------+------------------------------------------------------+ | ``[position]`` | Selects all elements that are located at the given | | | position.
The position can be either an integer |
| | (1 is the first position), the expression ``last()`` |
| | (for the last pos... | | | | | .. versionadded:: 3.10 | +-----------------------+------------------------------------------------------+ | ``[position]`` | Selects all elements that are located at the given | | | position.
The position can be either an integer |
| | (1 is the first position), the expression ``last()`` |
| | (for the last pos... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
418a25a8-c99a-41cc-8def-22b5e9923edf | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,989 | supabase-export-v2 | 9bd59ca90263357c | at 0x7fa66db2be58>)] >>> parser.feed(' more text</mytag>') >>> for event, elem in parser.read_events(): ... print(event) ... print(elem.tag, 'text=', elem.text) ... end mytag text= sometext more text
The obvious use case is applications that operate in a non-blocking fashion
where the XML data is being received from a ... | trusted_official_docs | CPython Docs | at 0x7fa66db2be58>)] >>> parser.feed(' more text</mytag>') >>> for event, elem in parser.read_events(): ... print(event) ... print(elem.tag, 'text=', elem.text) ... end mytag text= sometext more text
The obvious use case is applications that operate in a non-blocking fashion
where the XML data is being received from a ... | at 0x7fa66db2be58>)] >>> parser.feed(' more text</mytag>') >>> for event, elem in parser.read_events(): ... print(event) ... print(elem.tag, 'text=', elem.text) ... end mytag text= sometext more text
The obvious use case is applications that operate in a non-blocking fashion
where the XML data is being received from a ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4509470e-cf04-4e6e-8915-4da2b7da7192 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,994 | supabase-export-v2 | 6f33d0faa9f7fdf4 | :class:`Element` has some useful methods that help iterate recursively over all the sub-tree below it (its children, their children, and so on). For example, :meth:`Element.iter`::
>>> for neighbor in root.iter('neighbor'):
... print(neighbor.attrib)
... {'name': 'Austria', 'direction': 'E'}
{'name': 'Switzerland', ... | trusted_official_docs | CPython Docs | :class:`Element` has some useful methods that help iterate recursively over all the sub-tree below it (its children, their children, and so on). For example, :meth:`Element.iter`::
>>> for neighbor in root.iter('neighbor'):
... print(neighbor.attrib)
... {'name': 'Austria', 'direction': 'E'}
{'name': 'Switzerland', ... | :class:`Element` has some useful methods that help iterate recursively over all the sub-tree below it (its children, their children, and so on). For example, :meth:`Element.iter`::
>>> for neighbor in root.iter('neighbor'):
... print(neighbor.attrib)
... {'name': 'Austria', 'direction': 'E'}
{'name': 'Switzerland', ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
456a7052-9859-4a96-9ffc-fa2e2a189d53 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,102 | supabase-export-v2 | 6f5b94a90e851993 | Subelement factory. This function creates an element instance, and appends it to an existing element.
The element name, attribute names, and attribute values can be either
bytestrings or Unicode strings. *parent* is the parent element. *tag* is
the subelement name. *attrib* is an optional dictionary, containing eleme... | trusted_official_docs | CPython Docs | Subelement factory. This function creates an element instance, and appends it to an existing element.
The element name, attribute names, and attribute values can be either
bytestrings or Unicode strings. *parent* is the parent element. *tag* is
the subelement name. *attrib* is an optional dictionary, containing eleme... | Subelement factory. This function creates an element instance, and appends it to an existing element.
The element name, attribute names, and attribute values can be either
bytestrings or Unicode strings. *parent* is the parent element. *tag* is
the subelement name. *attrib* is an optional dictionary, containing eleme... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47668dad-ae83-428b-b061-c2419e928d75 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,273 | supabase-export-v2 | c65d760fc4ae20b7 | .. method:: doctype(name, pubid, system)
Handles a doctype declaration. *name* is the doctype name. *pubid* is
the public identifier. *system* is the system identifier. This method
does not exist on the default :class:`TreeBuilder` class. | trusted_official_docs | CPython Docs | .. method:: doctype(name, pubid, system)
Handles a doctype declaration. *name* is the doctype name. *pubid* is
the public identifier. *system* is the system identifier. This method
does not exist on the default :class:`TreeBuilder` class. | .. method:: doctype(name, pubid, system)
Handles a doctype declaration. *name* is the doctype name. *pubid* is
the public identifier. *system* is the system identifier. This method
does not exist on the default :class:`TreeBuilder` class. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
478d6894-cc28-4ed6-be13-0a84ce5c16b3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,006 | supabase-export-v2 | b1491fec0b54765c | We can remove elements using :meth:`Element.remove`. Let's say we want to remove all countries with a rank higher than 50::
>>> for country in root.findall('country'):
... # using root.findall() to avoid removal during traversal
... rank = int(country.find('rank').text)
... if rank > 50:
... root.remove(country)
.... | trusted_official_docs | CPython Docs | We can remove elements using :meth:`Element.remove`. Let's say we want to remove all countries with a rank higher than 50::
>>> for country in root.findall('country'):
... # using root.findall() to avoid removal during traversal
... rank = int(country.find('rank').text)
... if rank > 50:
... root.remove(country)
.... | We can remove elements using :meth:`Element.remove`. Let's say we want to remove all countries with a rank higher than 50::
>>> for country in root.findall('country'):
... # using root.findall() to avoid removal during traversal
... rank = int(country.find('rank').text)
... if rank > 50:
... root.remove(country)
.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4856d65f-a7c0-4976-912e-1bfc9b8b59cd | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,168 | supabase-export-v2 | 4313dbaf2eadc976 | internal representation, and create the dictionary only if someone asks for it. To take advantage of such implementations, use the dictionary methods below whenever possible.
The following dictionary-like methods work on the element attributes. | trusted_official_docs | CPython Docs | internal representation, and create the dictionary only if someone asks for it. To take advantage of such implementations, use the dictionary methods below whenever possible.
The following dictionary-like methods work on the element attributes. | internal representation, and create the dictionary only if someone asks for it. To take advantage of such implementations, use the dictionary methods below whenever possible.
The following dictionary-like methods work on the element attributes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
48e215a6-0535-4a70-a918-83d79d38717f | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,311 | supabase-export-v2 | fa108b34ab7d1630 | where *event* is a string representing the type of event (e.g. ``"end"``) and *elem* is the encountered :class:`Element` object, or other context value as follows.
* ``start``, ``end``: the current Element. * ``comment``, ``pi``: the current comment / processing instruction
* ``start-ns``: a tuple ``(prefix, uri)`` na... | trusted_official_docs | CPython Docs | where *event* is a string representing the type of event (e.g. ``"end"``) and *elem* is the encountered :class:`Element` object, or other context value as follows.
* ``start``, ``end``: the current Element. * ``comment``, ``pi``: the current comment / processing instruction
* ``start-ns``: a tuple ``(prefix, uri)`` na... | where *event* is a string representing the type of event (e.g. ``"end"``) and *elem* is the encountered :class:`Element` object, or other context value as follows.
* ``start``, ``end``: the current Element. * ``comment``, ``pi``: the current comment / processing instruction
* ``start-ns``: a tuple ``(prefix, uri)`` na... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b5032f4-739f-4256-8ff9-3ee28746f150 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,990 | supabase-export-v2 | 813a33ad82a88eed | fashion where the XML data is being received from a socket or read incrementally from some storage device. In such cases, blocking reads are unacceptable.
Because it's so flexible, :class:`XMLPullParser` can be inconvenient to use for
simpler use-cases. If you don't mind your application blocking on reading XML
data bu... | trusted_official_docs | CPython Docs | fashion where the XML data is being received from a socket or read incrementally from some storage device. In such cases, blocking reads are unacceptable.
Because it's so flexible, :class:`XMLPullParser` can be inconvenient to use for
simpler use-cases. If you don't mind your application blocking on reading XML
data bu... | fashion where the XML data is being received from a socket or read incrementally from some storage device. In such cases, blocking reads are unacceptable.
Because it's so flexible, :class:`XMLPullParser` can be inconvenient to use for
simpler use-cases. If you don't mind your application blocking on reading XML
data bu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4d03f96e-7c68-49a1-b068-d90d7d98a4a9 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,986 | supabase-export-v2 | 2a1c30a6a4a1349e | Pull API for non-blocking parsing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most parsing functions provided by this module require the whole document
to be read at once before returning any result. It is possible to use an
:class:`XMLParser` and feed data into it incrementally, but it is a push API that
calls methods on a call... | trusted_official_docs | CPython Docs | Pull API for non-blocking parsing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most parsing functions provided by this module require the whole document
to be read at once before returning any result. It is possible to use an
:class:`XMLParser` and feed data into it incrementally, but it is a push API that
calls methods on a call... | Pull API for non-blocking parsing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most parsing functions provided by this module require the whole document
to be read at once before returning any result. It is possible to use an
:class:`XMLParser` and feed data into it incrementally, but it is a push API that
calls methods on a call... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4d7b39aa-cfdd-466a-b3eb-658e73e4405e | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,086 | supabase-export-v2 | c31ac6d80bcb87e5 | .. note::
:func:`iterparse` only guarantees that it has seen the ">" character of a
starting tag when it emits a "start" event, so the attributes are defined,
but the contents of the text and tail attributes are undefined at that
point. The same applies to the element children; they may or may not be
present. | trusted_official_docs | CPython Docs | .. note::
:func:`iterparse` only guarantees that it has seen the ">" character of a
starting tag when it emits a "start" event, so the attributes are defined,
but the contents of the text and tail attributes are undefined at that
point. The same applies to the element children; they may or may not be
present. | .. note::
:func:`iterparse` only guarantees that it has seen the ">" character of a
starting tag when it emits a "start" event, so the attributes are defined,
but the contents of the text and tail attributes are undefined at that
point. The same applies to the element children; they may or may not be
present. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4de1b0dc-26ac-4252-802a-c4ad33536a06 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,014 | supabase-export-v2 | f4e3aa190ed4c507 | Parsing XML with Namespaces ^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the XML input has `namespaces
<https://en.wikipedia.org/wiki/XML_namespace>`__, tags and attributes
with prefixes in the form ``prefix:sometag`` get expanded to
``{uri}sometag`` where the *prefix* is replaced by the full *URI*. Also, if there is a `default name... | trusted_official_docs | CPython Docs | Parsing XML with Namespaces ^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the XML input has `namespaces
<https://en.wikipedia.org/wiki/XML_namespace>`__, tags and attributes
with prefixes in the form ``prefix:sometag`` get expanded to
``{uri}sometag`` where the *prefix* is replaced by the full *URI*. Also, if there is a `default name... | Parsing XML with Namespaces ^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the XML input has `namespaces
<https://en.wikipedia.org/wiki/XML_namespace>`__, tags and attributes
with prefixes in the form ``prefix:sometag`` get expanded to
``{uri}sometag`` where the *prefix* is replaced by the full *URI*. Also, if there is a `default name... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4e9eee54-25f1-4760-ab18-3b73418da5de | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,012 | supabase-export-v2 | 452d92d951b910eb | The :func:`SubElement` function also provides a convenient way to create new sub-elements for a given element::
>>> a = ET.Element('a')
>>> b = ET.SubElement(a, 'b')
>>> c = ET.SubElement(a, 'c')
>>> d = ET.SubElement(c, 'd')
>>> ET.dump(a)
<a><b /><c><d /></c></a> | trusted_official_docs | CPython Docs | The :func:`SubElement` function also provides a convenient way to create new sub-elements for a given element::
>>> a = ET.Element('a')
>>> b = ET.SubElement(a, 'b')
>>> c = ET.SubElement(a, 'c')
>>> d = ET.SubElement(c, 'd')
>>> ET.dump(a)
<a><b /><c><d /></c></a> | The :func:`SubElement` function also provides a convenient way to create new sub-elements for a given element::
>>> a = ET.Element('a')
>>> b = ET.SubElement(a, 'b')
>>> c = ET.SubElement(a, 'c')
>>> d = ET.SubElement(c, 'd')
>>> ET.dump(a)
<a><b /><c><d /></c></a> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
500730aa-7182-471d-a3aa-9b6d7e076150 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,008 | supabase-export-v2 | d93a99d8b6601d09 | and modifying Python lists or dicts. Therefore, the example first collects all matching elements with ``root.findall()``, and only then iterates over the list of matches.
Our XML now looks like this: | trusted_official_docs | CPython Docs | and modifying Python lists or dicts. Therefore, the example first collects all matching elements with ``root.findall()``, and only then iterates over the list of matches.
Our XML now looks like this: | and modifying Python lists or dicts. Therefore, the example first collects all matching elements with ``root.findall()``, and only then iterates over the list of matches.
Our XML now looks like this: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
543c92d1-c095-4b57-a44d-0d42b5e11fb2 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,098 | supabase-export-v2 | cd94dfcca6c0513f | .. function:: register_namespace(prefix, uri)
Registers a namespace prefix. The registry is global, and any existing
mapping for either the given prefix or the namespace URI will be removed. *prefix* is a namespace prefix. *uri* is a namespace uri. Tags and
attributes in this namespace will be serialized with the giv... | trusted_official_docs | CPython Docs | .. function:: register_namespace(prefix, uri)
Registers a namespace prefix. The registry is global, and any existing
mapping for either the given prefix or the namespace URI will be removed. *prefix* is a namespace prefix. *uri* is a namespace uri. Tags and
attributes in this namespace will be serialized with the giv... | .. function:: register_namespace(prefix, uri)
Registers a namespace prefix. The registry is global, and any existing
mapping for either the given prefix or the namespace URI will be removed. *prefix* is a namespace prefix. *uri* is a namespace uri. Tags and
attributes in this namespace will be serialized with the giv... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55f52055-aab1-42e9-b476-7b3d273e4600 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,027 | supabase-export-v2 | 9ace9e38fd815fbd | XPath support -------------
This module provides limited support for
`XPath expressions <https://www.w3.org/TR/xpath>`_ for locating elements in a
tree. The goal is to support a small subset of the abbreviated syntax; a full
XPath engine is outside the scope of the module. | trusted_official_docs | CPython Docs | XPath support -------------
This module provides limited support for
`XPath expressions <https://www.w3.org/TR/xpath>`_ for locating elements in a
tree. The goal is to support a small subset of the abbreviated syntax; a full
XPath engine is outside the scope of the module. | XPath support -------------
This module provides limited support for
`XPath expressions <https://www.w3.org/TR/xpath>`_ for locating elements in a
tree. The goal is to support a small subset of the abbreviated syntax; a full
XPath engine is outside the scope of the module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
57a9a6eb-bf2b-4abd-ac0e-65694a7405c8 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,319 | supabase-export-v2 | 90b5e46c201b431f | .. class:: ParseError
XML parse error, raised by the various parsing methods in this module when
parsing fails. The string representation of an instance of this exception
will contain a user-friendly error message. In addition, it will have
the following attributes available: | trusted_official_docs | CPython Docs | .. class:: ParseError
XML parse error, raised by the various parsing methods in this module when
parsing fails. The string representation of an instance of this exception
will contain a user-friendly error message. In addition, it will have
the following attributes available: | .. class:: ParseError
XML parse error, raised by the various parsing methods in this module when
parsing fails. The string representation of an instance of this exception
will contain a user-friendly error message. In addition, it will have
the following attributes available: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
57d5bc7c-3e6f-4ae5-891c-70000ee53fe2 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,198 | supabase-export-v2 | aabba462d231b66d | .. method:: iterfind(match, namespaces=None)
Finds all matching subelements, by tag name or
:ref:`path <elementtree-xpath>`. Returns an iterable yielding all
matching elements in document order. *namespaces* is an optional mapping
from namespace prefix to full name. | trusted_official_docs | CPython Docs | .. method:: iterfind(match, namespaces=None)
Finds all matching subelements, by tag name or
:ref:`path <elementtree-xpath>`. Returns an iterable yielding all
matching elements in document order. *namespaces* is an optional mapping
from namespace prefix to full name. | .. method:: iterfind(match, namespaces=None)
Finds all matching subelements, by tag name or
:ref:`path <elementtree-xpath>`. Returns an iterable yielding all
matching elements in document order. *namespaces* is an optional mapping
from namespace prefix to full name. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b799d24-016a-44e3-b7a5-e3a293044133 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,065 | supabase-export-v2 | 4d9fcf5e19d73d4b | string can be either a bytestring or a Unicode string. *text* is a string containing the comment string. Returns an element instance representing a comment.
Note that :class:`XMLParser` skips over comments in the input
instead of creating comment objects for them. An :class:`ElementTree` will
only contain comment nod... | trusted_official_docs | CPython Docs | string can be either a bytestring or a Unicode string. *text* is a string containing the comment string. Returns an element instance representing a comment.
Note that :class:`XMLParser` skips over comments in the input
instead of creating comment objects for them. An :class:`ElementTree` will
only contain comment nod... | string can be either a bytestring or a Unicode string. *text* is a string containing the comment string. Returns an element instance representing a comment.
Note that :class:`XMLParser` skips over comments in the input
instead of creating comment objects for them. An :class:`ElementTree` will
only contain comment nod... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e6f8039-f3e9-4dda-a298-9d71b86035c3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,997 | supabase-export-v2 | 0e61dc2076ff85d9 | >>> for country in root.findall('country'): ... rank = country.find('rank').text ... name = country.get('name') ... print(name, rank) ... Liechtenstein 1 Singapore 4 Panama 68
More sophisticated specification of which elements to look for is possible by
using :ref:`XPath <elementtree-xpath>`. | trusted_official_docs | CPython Docs | >>> for country in root.findall('country'): ... rank = country.find('rank').text ... name = country.get('name') ... print(name, rank) ... Liechtenstein 1 Singapore 4 Panama 68
More sophisticated specification of which elements to look for is possible by
using :ref:`XPath <elementtree-xpath>`. | >>> for country in root.findall('country'): ... rank = country.find('rank').text ... name = country.get('name') ... print(name, rank) ... Liechtenstein 1 Singapore 4 Panama 68
More sophisticated specification of which elements to look for is possible by
using :ref:`XPath <elementtree-xpath>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6e9a29f7-a517-47eb-b514-a93bb8a9bd1f | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,077 | supabase-export-v2 | e833b3cd1b167276 | .. function:: indent(tree, space=" ", level=0)
Appends whitespace to the subtree to indent the tree visually. This can be used to generate pretty-printed XML output. *tree* can be an Element or ElementTree. *space* is the whitespace
string that will be inserted for each indentation level, two space
characters by defa... | trusted_official_docs | CPython Docs | .. function:: indent(tree, space=" ", level=0)
Appends whitespace to the subtree to indent the tree visually. This can be used to generate pretty-printed XML output. *tree* can be an Element or ElementTree. *space* is the whitespace
string that will be inserted for each indentation level, two space
characters by defa... | .. function:: indent(tree, space=" ", level=0)
Appends whitespace to the subtree to indent the tree visually. This can be used to generate pretty-printed XML output. *tree* can be an Element or ElementTree. *space* is the whitespace
string that will be inserted for each indentation level, two space
characters by defa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6f816f67-de8a-4d1c-9230-d39e51fbfcf3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,281 | supabase-export-v2 | 89ccfed5b52760a1 | .. class:: C14NWriterTarget(write, *, \ with_comments=False, strip_text=False, rewrite_prefixes=False, \ qname_aware_tags=None, qname_aware_attrs=None, \ exclude_attrs=None, exclude_tags=None)
A `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ writer. Arguments are the
same as for the :func:`canonicalize` function. This... | trusted_official_docs | CPython Docs | .. class:: C14NWriterTarget(write, *, \ with_comments=False, strip_text=False, rewrite_prefixes=False, \ qname_aware_tags=None, qname_aware_attrs=None, \ exclude_attrs=None, exclude_tags=None)
A `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ writer. Arguments are the
same as for the :func:`canonicalize` function. This... | .. class:: C14NWriterTarget(write, *, \ with_comments=False, strip_text=False, rewrite_prefixes=False, \ qname_aware_tags=None, qname_aware_attrs=None, \ exclude_attrs=None, exclude_tags=None)
A `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ writer. Arguments are the
same as for the :func:`canonicalize` function. This... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
72f6021c-9dfa-40c8-977d-b5154c62513f | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,977 | supabase-export-v2 | 35622b41b8016e6f | into an :class:`Element`, which is the root element of the parsed tree. Other parsing functions may create an :class:`ElementTree`. Check the documentation to be sure.
As an :class:`Element`, ``root`` has a tag and a dictionary of attributes:: | trusted_official_docs | CPython Docs | into an :class:`Element`, which is the root element of the parsed tree. Other parsing functions may create an :class:`ElementTree`. Check the documentation to be sure.
As an :class:`Element`, ``root`` has a tag and a dictionary of attributes:: | into an :class:`Element`, which is the root element of the parsed tree. Other parsing functions may create an :class:`ElementTree`. Check the documentation to be sure.
As an :class:`Element`, ``root`` has a tag and a dictionary of attributes:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
74f6d505-a043-49a7-83d5-23d53900949d | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,308 | supabase-export-v2 | 5de74015f12253fb | .. method:: close()
Signal the parser that the data stream is terminated. Unlike
:meth:`XMLParser.close`, this method always returns :const:`None`. Any events not yet retrieved when the parser is closed can still be
read with :meth:`read_events`. | trusted_official_docs | CPython Docs | .. method:: close()
Signal the parser that the data stream is terminated. Unlike
:meth:`XMLParser.close`, this method always returns :const:`None`. Any events not yet retrieved when the parser is closed can still be
read with :meth:`read_events`. | .. method:: close()
Signal the parser that the data stream is terminated. Unlike
:meth:`XMLParser.close`, this method always returns :const:`None`. Any events not yet retrieved when the parser is closed can still be
read with :meth:`read_events`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
75e5ebab-b202-4d6d-bbe2-fdfac36afc23 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,044 | supabase-export-v2 | a4d165dd4b773de0 | the start | | | element (the element ``find`` was called on). | +-----------------------+------------------------------------------------------+ | ``[@attrib]`` | Selects all elements that have the given attribute.
|
+-----------------------+------------------------------------------------------+
| ``[@attrib='value']`... | trusted_official_docs | CPython Docs | the start | | | element (the element ``find`` was called on). | +-----------------------+------------------------------------------------------+ | ``[@attrib]`` | Selects all elements that have the given attribute.
|
+-----------------------+------------------------------------------------------+
| ``[@attrib='value']`... | the start | | | element (the element ``find`` was called on). | +-----------------------+------------------------------------------------------+ | ``[@attrib]`` | Selects all elements that have the given attribute.
|
+-----------------------+------------------------------------------------------+
| ``[@attrib='value']`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
75e92a5b-1f82-46a1-9193-3c489fcf1821 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,082 | supabase-export-v2 | 82d1893110b877a9 | .. function:: iterparse(source, events=None, parser=None)
Parses an XML section into an element tree incrementally, and reports what's
going on to the user. *source* is a filename or :term:`file object`
containing XML data. *events* is a sequence of events to report back. The
supported events are the strings ``"star... | trusted_official_docs | CPython Docs | .. function:: iterparse(source, events=None, parser=None)
Parses an XML section into an element tree incrementally, and reports what's
going on to the user. *source* is a filename or :term:`file object`
containing XML data. *events* is a sequence of events to report back. The
supported events are the strings ``"star... | .. function:: iterparse(source, events=None, parser=None)
Parses an XML section into an element tree incrementally, and reports what's
going on to the user. *source* is a filename or :term:`file object`
containing XML data. *events* is a sequence of events to report back. The
supported events are the strings ``"star... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
784ab177-7eb9-4435-9605-4f22c276d817 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,232 | supabase-export-v2 | 7a45e2eae8c0e5fb | .. method:: iter(tag=None)
Creates and returns a tree iterator for the root element. The iterator
loops over all elements in this tree, in section order. *tag* is the tag
to look for (default is to return all elements). | trusted_official_docs | CPython Docs | .. method:: iter(tag=None)
Creates and returns a tree iterator for the root element. The iterator
loops over all elements in this tree, in section order. *tag* is the tag
to look for (default is to return all elements). | .. method:: iter(tag=None)
Creates and returns a tree iterator for the root element. The iterator
loops over all elements in this tree, in section order. *tag* is the tag
to look for (default is to return all elements). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a45105d-fce8-462d-b9e0-2d4d0d6b83fe | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,976 | supabase-export-v2 | 7d69d581b75e2f51 | root = ET.fromstring(country_data_as_string)
:func:`fromstring` parses XML from a string directly into an :class:`Element`,
which is the root element of the parsed tree. Other parsing functions may
create an :class:`ElementTree`. Check the documentation to be sure. | trusted_official_docs | CPython Docs | root = ET.fromstring(country_data_as_string)
:func:`fromstring` parses XML from a string directly into an :class:`Element`,
which is the root element of the parsed tree. Other parsing functions may
create an :class:`ElementTree`. Check the documentation to be sure. | root = ET.fromstring(country_data_as_string)
:func:`fromstring` parses XML from a string directly into an :class:`Element`,
which is the root element of the parsed tree. Other parsing functions may
create an :class:`ElementTree`. Check the documentation to be sure. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a65e3eb-a197-41d6-bc06-cd6257af065b | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,164 | supabase-export-v2 | a5658a70c22dc307 | has *text* ``"1"`` and *tail* ``"4"``, the *c* element has *text* ``"2"`` and *tail* ``None``, and the *d* element has *text* ``None`` and *tail* ``"3"``.
To collect the inner text of an element, see :meth:`itertext`, for
example ``"".join(element.itertext())``. | trusted_official_docs | CPython Docs | has *text* ``"1"`` and *tail* ``"4"``, the *c* element has *text* ``"2"`` and *tail* ``None``, and the *d* element has *text* ``None`` and *tail* ``"3"``.
To collect the inner text of an element, see :meth:`itertext`, for
example ``"".join(element.itertext())``. | has *text* ``"1"`` and *tail* ``"4"``, the *c* element has *text* ``"2"`` and *tail* ``None``, and the *d* element has *text* ``None`` and *tail* ``"3"``.
To collect the inner text of an element, see :meth:`itertext`, for
example ``"".join(element.itertext())``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c8e526b-99c2-4f16-8ab4-90b0a3786e06 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,042 | supabase-export-v2 | 37aa0c5bbed5ece8 | tags named | | | ``spam`` in any (or no) namespace, and ``{}*`` | | | only selects tags that are not in a namespace.
|
| | |
| | .. versionchanged:: 3.8 |
| | Support for star-wildcards was added. |
+-----------------------+------------------------------------------------------+
| ``*`` | Selects all child elements, in... | trusted_official_docs | CPython Docs | tags named | | | ``spam`` in any (or no) namespace, and ``{}*`` | | | only selects tags that are not in a namespace.
|
| | |
| | .. versionchanged:: 3.8 |
| | Support for star-wildcards was added. |
+-----------------------+------------------------------------------------------+
| ``*`` | Selects all child elements, in... | tags named | | | ``spam`` in any (or no) namespace, and ``{}*`` | | | only selects tags that are not in a namespace.
|
| | |
| | .. versionchanged:: 3.8 |
| | Support for star-wildcards was added. |
+-----------------------+------------------------------------------------------+
| ``*`` | Selects all child elements, in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d387787-f5a9-4d37-85fb-4f1e48d6771a | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,054 | supabase-export-v2 | da9e161a7886349f | have and instead generates a more constrained XML representation. The main restrictions regard the placement of namespace declarations, the ordering of attributes, and ignorable whitespace.
This function takes an XML data string (*xml_data*) or a file path or
file-like object (*from_file*) as input, converts it to the... | trusted_official_docs | CPython Docs | have and instead generates a more constrained XML representation. The main restrictions regard the placement of namespace declarations, the ordering of attributes, and ignorable whitespace.
This function takes an XML data string (*xml_data*) or a file path or
file-like object (*from_file*) as input, converts it to the... | have and instead generates a more constrained XML representation. The main restrictions regard the placement of namespace declarations, the ordering of attributes, and ignorable whitespace.
This function takes an XML data string (*xml_data*) or a file path or
file-like object (*from_file*) as input, converts it to the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8255d11c-b343-4eca-9d98-0d67a22ff041 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,148 | supabase-export-v2 | 7ccc5c090e70f822 | .. function:: include(elem, loader=None, base_url=None, max_depth=6)
This function expands XInclude directives in-place in tree pointed by *elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or an
:class:`~xml.etree.ElementTree.ElementTree` instance to find such element. *loader* is an optional r... | trusted_official_docs | CPython Docs | .. function:: include(elem, loader=None, base_url=None, max_depth=6)
This function expands XInclude directives in-place in tree pointed by *elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or an
:class:`~xml.etree.ElementTree.ElementTree` instance to find such element. *loader* is an optional r... | .. function:: include(elem, loader=None, base_url=None, max_depth=6)
This function expands XInclude directives in-place in tree pointed by *elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or an
:class:`~xml.etree.ElementTree.ElementTree` instance to find such element. *loader* is an optional r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83e89fed-cf1d-4507-a02c-82526eb21733 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,015 | supabase-export-v2 | b49bd34d29eb9ca5 | is replaced by the full *URI*. Also, if there is a `default namespace <https://www.w3.org/TR/xml-names/#defaulting>`__, that full URI gets prepended to all of the non-prefixed tags.
Here is an XML example that incorporates two namespaces, one with the
prefix "fictional" and the other serving as the default namespace: | trusted_official_docs | CPython Docs | is replaced by the full *URI*. Also, if there is a `default namespace <https://www.w3.org/TR/xml-names/#defaulting>`__, that full URI gets prepended to all of the non-prefixed tags.
Here is an XML example that incorporates two namespaces, one with the
prefix "fictional" and the other serving as the default namespace: | is replaced by the full *URI*. Also, if there is a `default namespace <https://www.w3.org/TR/xml-names/#defaulting>`__, that full URI gets prepended to all of the non-prefixed tags.
Here is an XML example that incorporates two namespaces, one with the
prefix "fictional" and the other serving as the default namespace: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84aeb1cc-67a5-49ac-8c58-38466a4147e2 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,018 | supabase-export-v2 | a678af58dbe21678 | <?xml version="1.0"?> <actors xmlns:fictional="http://characters.example.com" xmlns="http://people.example.com"> <actor> <name>John Cleese</name> <fictional:character>Lancelot</fictional:character> <fictional:character>Archie Leach</fictional:character> </actor> <actor> <name>Eric Idle</name> <fictional:character>Sir R... | trusted_official_docs | CPython Docs | <?xml version="1.0"?> <actors xmlns:fictional="http://characters.example.com" xmlns="http://people.example.com"> <actor> <name>John Cleese</name> <fictional:character>Lancelot</fictional:character> <fictional:character>Archie Leach</fictional:character> </actor> <actor> <name>Eric Idle</name> <fictional:character>Sir R... | <?xml version="1.0"?> <actors xmlns:fictional="http://characters.example.com" xmlns="http://people.example.com"> <actor> <name>John Cleese</name> <fictional:character>Lancelot</fictional:character> <fictional:character>Archie Leach</fictional:character> </actor> <actor> <name>Eric Idle</name> <fictional:character>Sir R... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
873e1219-f065-41e3-83e4-1eea14dfa4bf | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,147 | supabase-export-v2 | 6793ad7f8d90916f | an :class:`~xml.etree.ElementTree.Element` instance. If the parse mode is ``"text"``, this is a string. If the loader fails, it can return ``None`` or raise an exception.
.. function:: include(elem, loader=None, base_url=None, max_depth=6) | trusted_official_docs | CPython Docs | an :class:`~xml.etree.ElementTree.Element` instance. If the parse mode is ``"text"``, this is a string. If the loader fails, it can return ``None`` or raise an exception.
.. function:: include(elem, loader=None, base_url=None, max_depth=6) | an :class:`~xml.etree.ElementTree.Element` instance. If the parse mode is ``"text"``, this is a string. If the loader fails, it can return ``None`` or raise an exception.
.. function:: include(elem, loader=None, base_url=None, max_depth=6) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89b3a064-cbc9-4827-a111-c8f8082da769 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,096 | supabase-export-v2 | b8c629cb23898623 | is a string containing the PI target. *text* is a string containing the PI contents, if given. Returns an element instance, representing a processing instruction.
Note that :class:`XMLParser` skips over processing instructions
in the input instead of creating PI objects for them. An
:class:`ElementTree` will only con... | trusted_official_docs | CPython Docs | is a string containing the PI target. *text* is a string containing the PI contents, if given. Returns an element instance, representing a processing instruction.
Note that :class:`XMLParser` skips over processing instructions
in the input instead of creating PI objects for them. An
:class:`ElementTree` will only con... | is a string containing the PI target. *text* is a string containing the PI contents, if given. Returns an element instance, representing a processing instruction.
Note that :class:`XMLParser` skips over processing instructions
in the input instead of creating PI objects for them. An
:class:`ElementTree` will only con... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89ec6d67-2294-4b28-9350-4c84616b1fc3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,009 | supabase-export-v2 | 7ff654a2b7174b9a | .. code-block:: xml
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank updated="yes">2</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
<country name="Singapore">
<rank updated="yes">5</rank>
<year>2... | trusted_official_docs | CPython Docs | .. code-block:: xml
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank updated="yes">2</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
<country name="Singapore">
<rank updated="yes">5</rank>
<year>2... | .. code-block:: xml
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank updated="yes">2</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
<country name="Singapore">
<rank updated="yes">5</rank>
<year>2... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89ed117f-b72e-4d8f-9e6e-152008c1e838 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,161 | supabase-export-v2 | 7343163d5630f5cc | .. attribute:: text tail
These attributes can be used to hold additional data associated with
the element. Their values are usually strings but may be any
application-specific object. If the element is created from
an XML file, the *text* attribute holds either the text between
the element's start tag and its first... | trusted_official_docs | CPython Docs | .. attribute:: text tail
These attributes can be used to hold additional data associated with
the element. Their values are usually strings but may be any
application-specific object. If the element is created from
an XML file, the *text* attribute holds either the text between
the element's start tag and its first... | .. attribute:: text tail
These attributes can be used to hold additional data associated with
the element. Their values are usually strings but may be any
application-specific object. If the element is created from
an XML file, the *text* attribute holds either the text between
the element's start tag and its first... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a329d33-ff6f-4a3c-9fbd-5af93560f7cd | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,087 | supabase-export-v2 | 142e60f66949d484 | of the text and tail attributes are undefined at that point. The same applies to the element children; they may or may not be present.
If you need a fully populated element, look for "end" events instead. | trusted_official_docs | CPython Docs | of the text and tail attributes are undefined at that point. The same applies to the element children; they may or may not be present.
If you need a fully populated element, look for "end" events instead. | of the text and tail attributes are undefined at that point. The same applies to the element children; they may or may not be present.
If you need a fully populated element, look for "end" events instead. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d715f3c-1583-4ee0-b096-39186fdbd1b4 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,240 | supabase-export-v2 | 7fe58ca6d340dfc3 | contain no content. If ``True`` (the default), they are emitted as a single self-closed tag, otherwise they are emitted as a pair of start/end tags.
The output is either a string (:class:`str`) or binary (:class:`bytes`). This is controlled by the *encoding* argument. If *encoding* is
``"unicode"``, the output is a st... | trusted_official_docs | CPython Docs | contain no content. If ``True`` (the default), they are emitted as a single self-closed tag, otherwise they are emitted as a pair of start/end tags.
The output is either a string (:class:`str`) or binary (:class:`bytes`). This is controlled by the *encoding* argument. If *encoding* is
``"unicode"``, the output is a st... | contain no content. If ``True`` (the default), they are emitted as a single self-closed tag, otherwise they are emitted as a pair of start/end tags.
The output is either a string (:class:`str`) or binary (:class:`bytes`). This is controlled by the *encoding* argument. If *encoding* is
``"unicode"``, the output is a st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
913c9b08-999d-40a8-99ff-422a269546e3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,074 | supabase-export-v2 | 0c8cbddb78a97b7b | .. function:: fromstringlist(sequence, parser=None)
Parses an XML document from a sequence of string fragments. *sequence* is a
list or other sequence containing XML data fragments. *parser* is an
optional parser instance. If not given, the standard :class:`XMLParser`
parser is used. Returns an :class:`Element` inst... | trusted_official_docs | CPython Docs | .. function:: fromstringlist(sequence, parser=None)
Parses an XML document from a sequence of string fragments. *sequence* is a
list or other sequence containing XML data fragments. *parser* is an
optional parser instance. If not given, the standard :class:`XMLParser`
parser is used. Returns an :class:`Element` inst... | .. function:: fromstringlist(sequence, parser=None)
Parses an XML document from a sequence of string fragments. *sequence* is a
list or other sequence containing XML data fragments. *parser* is an
optional parser instance. If not given, the standard :class:`XMLParser`
parser is used. Returns an :class:`Element` inst... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
93bfbbb3-92e5-404c-9302-657eb6f0d635 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,084 | supabase-export-v2 | f9fa2127b04a0181 | The iterator has the :meth:`!close` method that closes the internal file object if *source* is a filename.
Note that while :func:`iterparse` builds the tree incrementally, it issues
blocking reads on *source* (or the file it names). As such, it's unsuitable
for applications where blocking reads can't be made. For ful... | trusted_official_docs | CPython Docs | The iterator has the :meth:`!close` method that closes the internal file object if *source* is a filename.
Note that while :func:`iterparse` builds the tree incrementally, it issues
blocking reads on *source* (or the file it names). As such, it's unsuitable
for applications where blocking reads can't be made. For ful... | The iterator has the :meth:`!close` method that closes the internal file object if *source* is a filename.
Note that while :func:`iterparse` builds the tree incrementally, it issues
blocking reads on *source* (or the file it names). As such, it's unsuitable
for applications where blocking reads can't be made. For ful... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
954de9a9-90ea-4678-aabb-aa17e752d625 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,981 | supabase-export-v2 | 31ad87d935cdfff9 | >>> for child in root: ... print(child.tag, child.attrib) ... country {'name': 'Liechtenstein'} country {'name': 'Singapore'} country {'name': 'Panama'}
Children are nested, and we can access specific child nodes by index:: | trusted_official_docs | CPython Docs | >>> for child in root: ... print(child.tag, child.attrib) ... country {'name': 'Liechtenstein'} country {'name': 'Singapore'} country {'name': 'Panama'}
Children are nested, and we can access specific child nodes by index:: | >>> for child in root: ... print(child.tag, child.attrib) ... country {'name': 'Liechtenstein'} country {'name': 'Singapore'} country {'name': 'Panama'}
Children are nested, and we can access specific child nodes by index:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
989159ba-84a8-4acd-bd61-3a53cb20d7e6 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,191 | supabase-export-v2 | e27a589439f6112d | .. method:: findtext(match, default=None, namespaces=None)
Finds text for the first subelement matching *match*. *match* may be
a tag name or a :ref:`path <elementtree-xpath>`. Returns the text content
of the first matching element, or *default* if no element was found. Note that if the matching element has no text c... | trusted_official_docs | CPython Docs | .. method:: findtext(match, default=None, namespaces=None)
Finds text for the first subelement matching *match*. *match* may be
a tag name or a :ref:`path <elementtree-xpath>`. Returns the text content
of the first matching element, or *default* if no element was found. Note that if the matching element has no text c... | .. method:: findtext(match, default=None, namespaces=None)
Finds text for the first subelement matching *match*. *match* may be
a tag name or a :ref:`path <elementtree-xpath>`. Returns the text content
of the first matching element, or *default* if no element was found. Note that if the matching element has no text c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9bea3cfe-fdec-4a9a-b67c-0eee7c0c56e7 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,167 | supabase-export-v2 | f111780b409e6327 | .. attribute:: attrib
A dictionary containing the element's attributes. Note that while the
*attrib* value is always a real mutable Python dictionary, an ElementTree
implementation may choose to use another internal representation, and
create the dictionary only if someone asks for it. To take advantage of
such imp... | trusted_official_docs | CPython Docs | .. attribute:: attrib
A dictionary containing the element's attributes. Note that while the
*attrib* value is always a real mutable Python dictionary, an ElementTree
implementation may choose to use another internal representation, and
create the dictionary only if someone asks for it. To take advantage of
such imp... | .. attribute:: attrib
A dictionary containing the element's attributes. Note that while the
*attrib* value is always a real mutable Python dictionary, an ElementTree
implementation may choose to use another internal representation, and
create the dictionary only if someone asks for it. To take advantage of
such imp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9bfb1924-643c-4647-8bba-4c0b4f42a65b | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,061 | supabase-export-v2 | cae357d9b3ff8288 | empty) - *exclude_attrs*: a set of attribute names that should not be serialised - *exclude_tags*: a set of tag names that should not be serialised
In the option list above, "a set" refers to any collection or iterable of
strings, no ordering is expected. | trusted_official_docs | CPython Docs | empty) - *exclude_attrs*: a set of attribute names that should not be serialised - *exclude_tags*: a set of tag names that should not be serialised
In the option list above, "a set" refers to any collection or iterable of
strings, no ordering is expected. | empty) - *exclude_attrs*: a set of attribute names that should not be serialised - *exclude_tags*: a set of tag names that should not be serialised
In the option list above, "a set" refers to any collection or iterable of
strings, no ordering is expected. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9d115bcb-da1d-4900-8037-eb782c013a05 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,049 | supabase-export-v2 | 92513335ca422f38 | the expression ``last()`` | | | (for the last position), or a position relative to | | | the last position (e.g. ``last()-1``). | +-----------------------+------------------------------------------------------+
Predicates (expressions within square brackets) must be preceded by a tag
name, an asterisk, or another predi... | trusted_official_docs | CPython Docs | the expression ``last()`` | | | (for the last position), or a position relative to | | | the last position (e.g. ``last()-1``). | +-----------------------+------------------------------------------------------+
Predicates (expressions within square brackets) must be preceded by a tag
name, an asterisk, or another predi... | the expression ``last()`` | | | (for the last position), or a position relative to | | | the last position (e.g. ``last()-1``). | +-----------------------+------------------------------------------------------+
Predicates (expressions within square brackets) must be preceded by a tag
name, an asterisk, or another predi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f37719d-c07b-490b-9471-eeadaf7d1bcb | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,106 | supabase-export-v2 | 275afdfad5572ddc | .. function:: tostring(element, encoding="us-ascii", method="xml", *, \ xml_declaration=None, default_namespace=None, \ short_empty_elements=True)
Generates a string representation of an XML element, including all
subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is
the output encoding (default ... | trusted_official_docs | CPython Docs | .. function:: tostring(element, encoding="us-ascii", method="xml", *, \ xml_declaration=None, default_namespace=None, \ short_empty_elements=True)
Generates a string representation of an XML element, including all
subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is
the output encoding (default ... | .. function:: tostring(element, encoding="us-ascii", method="xml", *, \ xml_declaration=None, default_namespace=None, \ short_empty_elements=True)
Generates a string representation of an XML element, including all
subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is
the output encoding (default ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3ec2846-ea6a-4a8e-ba9a-dbb6caaa7701 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,965 | supabase-export-v2 | 02828ce3b62d53b1 | a short tutorial for using :mod:`!xml.etree.ElementTree` (``ET`` in short). The goal is to demonstrate some of the building blocks and basic concepts of the module.
XML tree and elements
^^^^^^^^^^^^^^^^^^^^^ | trusted_official_docs | CPython Docs | a short tutorial for using :mod:`!xml.etree.ElementTree` (``ET`` in short). The goal is to demonstrate some of the building blocks and basic concepts of the module.
XML tree and elements
^^^^^^^^^^^^^^^^^^^^^ | a short tutorial for using :mod:`!xml.etree.ElementTree` (``ET`` in short). The goal is to demonstrate some of the building blocks and basic concepts of the module.
XML tree and elements
^^^^^^^^^^^^^^^^^^^^^ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a7edbbad-6e80-4a3c-9aac-c8cf89acb1bd | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,256 | supabase-export-v2 | 7578f724019d78a4 | given, must be a callable accepting two positional arguments: a tag and a dict of attributes. It is expected to return a new element instance.
The *comment_factory* and *pi_factory* functions, when given, should behave
like the :func:`Comment` and :func:`ProcessingInstruction` functions to
create comments and process... | trusted_official_docs | CPython Docs | given, must be a callable accepting two positional arguments: a tag and a dict of attributes. It is expected to return a new element instance.
The *comment_factory* and *pi_factory* functions, when given, should behave
like the :func:`Comment` and :func:`ProcessingInstruction` functions to
create comments and process... | given, must be a callable accepting two positional arguments: a tag and a dict of attributes. It is expected to return a new element instance.
The *comment_factory* and *pi_factory* functions, when given, should behave
like the :func:`Comment` and :func:`ProcessingInstruction` functions to
create comments and process... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
abde2d1c-83e2-4426-9db3-bd64879fd4e9 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,995 | supabase-export-v2 | 3986a51ad698edae | root.iter('neighbor'): ... print(neighbor.attrib) ... {'name': 'Austria', 'direction': 'E'} {'name': 'Switzerland', 'direction': 'W'} {'name': 'Malaysia', 'direction': 'N'} {'name': 'Costa Rica', 'direction': 'W'} {'name': 'Colombia', 'direction': 'E'}
:meth:`Element.findall` finds only elements with a tag which are di... | trusted_official_docs | CPython Docs | root.iter('neighbor'): ... print(neighbor.attrib) ... {'name': 'Austria', 'direction': 'E'} {'name': 'Switzerland', 'direction': 'W'} {'name': 'Malaysia', 'direction': 'N'} {'name': 'Costa Rica', 'direction': 'W'} {'name': 'Colombia', 'direction': 'E'}
:meth:`Element.findall` finds only elements with a tag which are di... | root.iter('neighbor'): ... print(neighbor.attrib) ... {'name': 'Austria', 'direction': 'E'} {'name': 'Switzerland', 'direction': 'W'} {'name': 'Malaysia', 'direction': 'N'} {'name': 'Costa Rica', 'direction': 'W'} {'name': 'Colombia', 'direction': 'E'}
:meth:`Element.findall` finds only elements with a tag which are di... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad639dc0-d210-468f-8037-fbcc287d4c8d | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,212 | supabase-export-v2 | 285cbc2a5efdcc88 | .. versionchanged:: 3.12 Testing the truth value of an Element emits :exc:`DeprecationWarning`.
Prior to Python 3.8, the serialisation order of the XML attributes of
elements was artificially made predictable by sorting the attributes by
their name. Based on the now guaranteed ordering of dicts, this arbitrary
reord... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.12 Testing the truth value of an Element emits :exc:`DeprecationWarning`.
Prior to Python 3.8, the serialisation order of the XML attributes of
elements was artificially made predictable by sorting the attributes by
their name. Based on the now guaranteed ordering of dicts, this arbitrary
reord... | .. versionchanged:: 3.12 Testing the truth value of an Element emits :exc:`DeprecationWarning`.
Prior to Python 3.8, the serialisation order of the XML attributes of
elements was artificially made predictable by sorting the attributes by
their name. Based on the now guaranteed ordering of dicts, this arbitrary
reord... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ae4576c5-2e24-4e25-abcc-3fd257653d31 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,095 | supabase-export-v2 | ece267a26e5f7e86 | .. function:: ProcessingInstruction(target, text=None)
PI element factory. This factory function creates a special element that
will be serialized as an XML processing instruction. *target* is a string
containing the PI target. *text* is a string containing the PI contents, if
given. Returns an element instance, rep... | trusted_official_docs | CPython Docs | .. function:: ProcessingInstruction(target, text=None)
PI element factory. This factory function creates a special element that
will be serialized as an XML processing instruction. *target* is a string
containing the PI target. *text* is a string containing the PI contents, if
given. Returns an element instance, rep... | .. function:: ProcessingInstruction(target, text=None)
PI element factory. This factory function creates a special element that
will be serialized as an XML processing instruction. *target* is a string
containing the PI target. *text* is a string containing the PI contents, if
given. Returns an element instance, rep... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b0dc0329-9463-46e5-a16b-0aacad407f94 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,310 | supabase-export-v2 | a6e2bbc65d0ce24e | .. method:: read_events()
Return an iterator over the events which have been encountered in the
data fed to the
parser. The iterator yields ``(event, elem)`` pairs, where *event* is a
string representing the type of event (e.g. ``"end"``) and *elem* is the
encountered :class:`Element` object, or other context value... | trusted_official_docs | CPython Docs | .. method:: read_events()
Return an iterator over the events which have been encountered in the
data fed to the
parser. The iterator yields ``(event, elem)`` pairs, where *event* is a
string representing the type of event (e.g. ``"end"``) and *elem* is the
encountered :class:`Element` object, or other context value... | .. method:: read_events()
Return an iterator over the events which have been encountered in the
data fed to the
parser. The iterator yields ``(event, elem)`` pairs, where *event* is a
string representing the type of event (e.g. ``"end"``) and *elem* is the
encountered :class:`Element` object, or other context value... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b13aaa73-f155-495b-8db0-7e6da4f36088 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,239 | supabase-export-v2 | 522619370dad47e8 | .. method:: write(file, encoding="us-ascii", xml_declaration=None, \ default_namespace=None, method="xml", *, \ short_empty_elements=True)
Writes the element tree to a file, as XML. *file* is a file name, or a
:term:`file object` opened for writing. *encoding* [1]_ is the output
encoding (default is US-ASCII). *xml_d... | trusted_official_docs | CPython Docs | .. method:: write(file, encoding="us-ascii", xml_declaration=None, \ default_namespace=None, method="xml", *, \ short_empty_elements=True)
Writes the element tree to a file, as XML. *file* is a file name, or a
:term:`file object` opened for writing. *encoding* [1]_ is the output
encoding (default is US-ASCII). *xml_d... | .. method:: write(file, encoding="us-ascii", xml_declaration=None, \ default_namespace=None, method="xml", *, \ short_empty_elements=True)
Writes the element tree to a file, as XML. *file* is a file name, or a
:term:`file object` opened for writing. *encoding* [1]_ is the output
encoding (default is US-ASCII). *xml_d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b5c183b5-f418-490b-8d45-19372cfb3f63 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,007 | supabase-export-v2 | 70b7312f4e549cbe | in root.findall('country'): ... # using root.findall() to avoid removal during traversal ... rank = int(country.find('rank').text) ... if rank > 50: ... root.remove(country) ... >>> tree.write('output.xml')
Note that concurrent modification while iterating can lead to problems,
just like when iterating and modifying Py... | trusted_official_docs | CPython Docs | in root.findall('country'): ... # using root.findall() to avoid removal during traversal ... rank = int(country.find('rank').text) ... if rank > 50: ... root.remove(country) ... >>> tree.write('output.xml')
Note that concurrent modification while iterating can lead to problems,
just like when iterating and modifying Py... | in root.findall('country'): ... # using root.findall() to avoid removal during traversal ... rank = int(country.find('rank').text) ... if rank > 50: ... root.remove(country) ... >>> tree.write('output.xml')
Note that concurrent modification while iterating can lead to problems,
just like when iterating and modifying Py... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b7e1041c-8a84-42b4-8e0b-5d67c361879b | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,122 | supabase-export-v2 | 43f78e639b3699f1 | XInclude support ----------------
This module provides limited support for
`XInclude directives <https://www.w3.org/TR/xinclude/>`_, via the :mod:`xml.etree.ElementInclude` helper module. This module can be used to insert subtrees and text strings into element trees, based on information in the tree. | trusted_official_docs | CPython Docs | XInclude support ----------------
This module provides limited support for
`XInclude directives <https://www.w3.org/TR/xinclude/>`_, via the :mod:`xml.etree.ElementInclude` helper module. This module can be used to insert subtrees and text strings into element trees, based on information in the tree. | XInclude support ----------------
This module provides limited support for
`XInclude directives <https://www.w3.org/TR/xinclude/>`_, via the :mod:`xml.etree.ElementInclude` helper module. This module can be used to insert subtrees and text strings into element trees, based on information in the tree. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b7f3cddf-4879-4dae-89a1-854d5cb1d535 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,043 | supabase-export-v2 | 75cc8c487c886266 | current node. This is mostly useful | | | at the beginning of the path, to indicate that it's | | | a relative path.
|
+-----------------------+------------------------------------------------------+
| ``//`` | Selects all subelements, on all levels beneath the |
| | current element. For example, ``.//egg`` selects |
|... | trusted_official_docs | CPython Docs | current node. This is mostly useful | | | at the beginning of the path, to indicate that it's | | | a relative path.
|
+-----------------------+------------------------------------------------------+
| ``//`` | Selects all subelements, on all levels beneath the |
| | current element. For example, ``.//egg`` selects |
|... | current node. This is mostly useful | | | at the beginning of the path, to indicate that it's | | | a relative path.
|
+-----------------------+------------------------------------------------------+
| ``//`` | Selects all subelements, on all levels beneath the |
| | current element. For example, ``.//egg`` selects |
|... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b8167c06-2128-4efc-b764-9a0c741bbea8 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,250 | supabase-export-v2 | 700f91111832bfc9 | .. class:: QName(text_or_uri, tag=None)
QName wrapper. This can be used to wrap a QName attribute value, in order
to get proper namespace handling on output. *text_or_uri* is a string
containing the QName value, in the form {uri}local, or, if the tag argument
is given, the URI part of a QName. If *tag* is given, the... | trusted_official_docs | CPython Docs | .. class:: QName(text_or_uri, tag=None)
QName wrapper. This can be used to wrap a QName attribute value, in order
to get proper namespace handling on output. *text_or_uri* is a string
containing the QName value, in the form {uri}local, or, if the tag argument
is given, the URI part of a QName. If *tag* is given, the... | .. class:: QName(text_or_uri, tag=None)
QName wrapper. This can be used to wrap a QName attribute value, in order
to get proper namespace handling on output. *text_or_uri* is a string
containing the QName value, in the form {uri}local, or, if the tag argument
is given, the URI part of a QName. If *tag* is given, the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b935d9c6-46b0-4d52-a261-053523f61158 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,047 | supabase-export-v2 | 0c6f3631373e6c76 | Selects all elements that have a child named | | | ``tag`` whose complete text content, including | | | descendants, equals the given ``text``.
|
+-----------------------+------------------------------------------------------+
| ``[tag!='text']`` | Selects all elements that have a child named |
| | ``tag`` whose comple... | trusted_official_docs | CPython Docs | Selects all elements that have a child named | | | ``tag`` whose complete text content, including | | | descendants, equals the given ``text``.
|
+-----------------------+------------------------------------------------------+
| ``[tag!='text']`` | Selects all elements that have a child named |
| | ``tag`` whose comple... | Selects all elements that have a child named | | | ``tag`` whose complete text content, including | | | descendants, equals the given ``text``.
|
+-----------------------+------------------------------------------------------+
| ``[tag!='text']`` | Selects all elements that have a child named |
| | ``tag`` whose comple... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b990f47b-f615-4777-853b-0491d1671b4a | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,246 | supabase-export-v2 | 91c6d1cdaca25fff | Example of changing the attribute "target" of every link in first paragraph::
>>> from xml.etree.ElementTree import ElementTree
>>> tree = ElementTree()
>>> tree.parse("index.xhtml")
<Element 'html' at 0xb77e6fac>
>>> p = tree.find("body/p") # Finds first occurrence of tag p in body
>>> p
<Element 'p' at 0xb77ec2... | trusted_official_docs | CPython Docs | Example of changing the attribute "target" of every link in first paragraph::
>>> from xml.etree.ElementTree import ElementTree
>>> tree = ElementTree()
>>> tree.parse("index.xhtml")
<Element 'html' at 0xb77e6fac>
>>> p = tree.find("body/p") # Finds first occurrence of tag p in body
>>> p
<Element 'p' at 0xb77ec2... | Example of changing the attribute "target" of every link in first paragraph::
>>> from xml.etree.ElementTree import ElementTree
>>> tree = ElementTree()
>>> tree.parse("index.xhtml")
<Element 'html' at 0xb77e6fac>
>>> p = tree.find("body/p") # Finds first occurrence of tag p in body
>>> p
<Element 'p' at 0xb77ec2... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bac2ff7c-421e-4600-8d12-fc3d9dcaf8c4 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,187 | supabase-export-v2 | 0262bda503ca0ebd | .. method:: find(match, namespaces=None)
Finds the first subelement matching *match*. *match* may be a tag name
or a :ref:`path <elementtree-xpath>`. Returns an element instance
or ``None``. *namespaces* is an optional mapping from namespace prefix
to full name. Pass ``''`` as prefix to move all unprefixed tag names... | trusted_official_docs | CPython Docs | .. method:: find(match, namespaces=None)
Finds the first subelement matching *match*. *match* may be a tag name
or a :ref:`path <elementtree-xpath>`. Returns an element instance
or ``None``. *namespaces* is an optional mapping from namespace prefix
to full name. Pass ``''`` as prefix to move all unprefixed tag names... | .. method:: find(match, namespaces=None)
Finds the first subelement matching *match*. *match* may be a tag name
or a :ref:`path <elementtree-xpath>`. Returns an element instance
or ``None``. *namespaces* is an optional mapping from namespace prefix
to full name. Pass ``''`` as prefix to move all unprefixed tag names... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bcab9bdc-ce4a-4310-ad8c-2e7cd07ba021 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,156 | supabase-export-v2 | 32101b42e71368eb | bytestrings or Unicode strings. *tag* is the element name. *attrib* is an optional dictionary, containing element attributes. *extra* contains additional attributes, given as keyword arguments.
.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`. | trusted_official_docs | CPython Docs | bytestrings or Unicode strings. *tag* is the element name. *attrib* is an optional dictionary, containing element attributes. *extra* contains additional attributes, given as keyword arguments.
.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`. | bytestrings or Unicode strings. *tag* is the element name. *attrib* is an optional dictionary, containing element attributes. *extra* contains additional attributes, given as keyword arguments.
.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c3573dfb-8c35-49ad-804e-85f78b705e9f | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,124 | supabase-export-v2 | 676ffe3d527bff6e | Example ^^^^^^^
Here's an example that demonstrates use of the XInclude module. To include an XML document in the current document, use the ``{http://www.w3.org/2001/XInclude}include`` element and set the **parse** attribute to ``"xml"``, and use the **href** attribute to specify the document to include. | trusted_official_docs | CPython Docs | Example ^^^^^^^
Here's an example that demonstrates use of the XInclude module. To include an XML document in the current document, use the ``{http://www.w3.org/2001/XInclude}include`` element and set the **parse** attribute to ``"xml"``, and use the **href** attribute to specify the document to include. | Example ^^^^^^^
Here's an example that demonstrates use of the XInclude module. To include an XML document in the current document, use the ``{http://www.w3.org/2001/XInclude}include`` element and set the **parse** attribute to ``"xml"``, and use the **href** attribute to specify the document to include. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c71e2533-1226-4057-9584-4c35888e6588 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,966 | supabase-export-v2 | 1f888e8f05cb2f9b | XML tree and elements ^^^^^^^^^^^^^^^^^^^^^
XML is an inherently hierarchical data format, and the most natural way to
represent it is with a tree. ``ET`` has two classes for this purpose -
:class:`ElementTree` represents the whole XML document as a tree, and
:class:`Element` represents a single node in this tree. Inte... | trusted_official_docs | CPython Docs | XML tree and elements ^^^^^^^^^^^^^^^^^^^^^
XML is an inherently hierarchical data format, and the most natural way to
represent it is with a tree. ``ET`` has two classes for this purpose -
:class:`ElementTree` represents the whole XML document as a tree, and
:class:`Element` represents a single node in this tree. Inte... | XML tree and elements ^^^^^^^^^^^^^^^^^^^^^
XML is an inherently hierarchical data format, and the most natural way to
represent it is with a tree. ``ET`` has two classes for this purpose -
:class:`ElementTree` represents the whole XML document as a tree, and
:class:`Element` represents a single node in this tree. Inte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c7305378-8ae9-4491-acfa-5b8cc21976b2 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,005 | supabase-export-v2 | d5291b0f251a92d8 | <country name="Singapore"> <rank updated="yes">5</rank> <year>2011</year> <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> <country name="Panama"> <rank updated="yes">69</rank> <year>2011</year> <gdppc>13600</gdppc> <neighbor name="Costa Rica" direction="W"/> <neighbor name="Colombia" direction... | trusted_official_docs | CPython Docs | <country name="Singapore"> <rank updated="yes">5</rank> <year>2011</year> <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> <country name="Panama"> <rank updated="yes">69</rank> <year>2011</year> <gdppc>13600</gdppc> <neighbor name="Costa Rica" direction="W"/> <neighbor name="Colombia" direction... | <country name="Singapore"> <rank updated="yes">5</rank> <year>2011</year> <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> <country name="Panama"> <rank updated="yes">69</rank> <year>2011</year> <gdppc>13600</gdppc> <neighbor name="Costa Rica" direction="W"/> <neighbor name="Colombia" direction... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c82c3d04-c81d-448b-942f-1676a0624771 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,238 | supabase-export-v2 | 7fafa86e26bc08a9 | file name or :term:`file object`. *parser* is an optional parser instance. If not given, the standard :class:`XMLParser` parser is used. Returns the section root element.
.. method:: write(file, encoding="us-ascii", xml_declaration=None, \
default_namespace=None, method="xml", *, \
short_empty_elements=True) | trusted_official_docs | CPython Docs | file name or :term:`file object`. *parser* is an optional parser instance. If not given, the standard :class:`XMLParser` parser is used. Returns the section root element.
.. method:: write(file, encoding="us-ascii", xml_declaration=None, \
default_namespace=None, method="xml", *, \
short_empty_elements=True) | file name or :term:`file object`. *parser* is an optional parser instance. If not given, the standard :class:`XMLParser` parser is used. Returns the section root element.
.. method:: write(file, encoding="us-ascii", xml_declaration=None, \
default_namespace=None, method="xml", *, \
short_empty_elements=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cdc1158c-bf0e-48a8-b1be-10d85d368359 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,002 | supabase-export-v2 | 921a7874a878b7a3 | Let's say we want to add one to each country's rank, and add an ``updated`` attribute to the rank element::
>>> for rank in root.iter('rank'):
... new_rank = int(rank.text) + 1
... rank.text = str(new_rank)
... rank.set('updated', 'yes')
... >>> tree.write('output.xml') | trusted_official_docs | CPython Docs | Let's say we want to add one to each country's rank, and add an ``updated`` attribute to the rank element::
>>> for rank in root.iter('rank'):
... new_rank = int(rank.text) + 1
... rank.text = str(new_rank)
... rank.set('updated', 'yes')
... >>> tree.write('output.xml') | Let's say we want to add one to each country's rank, and add an ``updated`` attribute to the rank element::
>>> for rank in root.iter('rank'):
... new_rank = int(rank.text) + 1
... rank.text = str(new_rank)
... rank.set('updated', 'yes')
... >>> tree.write('output.xml') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d78c6e20-1cc7-4bd4-b4ba-59e073294c51 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,213 | supabase-export-v2 | 7457a299affe69b7 | of dicts, this arbitrary reordering was removed in Python 3.8 to preserve the order in which attributes were originally parsed or created by user code.
In general, user code should try not to depend on a specific ordering of
attributes, given that the `XML Information Set
<https://www.w3.org/TR/xml-infoset/>`_ explic... | trusted_official_docs | CPython Docs | of dicts, this arbitrary reordering was removed in Python 3.8 to preserve the order in which attributes were originally parsed or created by user code.
In general, user code should try not to depend on a specific ordering of
attributes, given that the `XML Information Set
<https://www.w3.org/TR/xml-infoset/>`_ explic... | of dicts, this arbitrary reordering was removed in Python 3.8 to preserve the order in which attributes were originally parsed or created by user code.
In general, user code should try not to depend on a specific ordering of
attributes, given that the `XML Information Set
<https://www.w3.org/TR/xml-infoset/>`_ explic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d8c69bcd-1efb-4146-a3e5-f6a713cf85bc | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,190 | supabase-export-v2 | fc684ece2a5d004c | optional mapping from namespace prefix to full name. Pass ``''`` as prefix to move all unprefixed tag names in the expression into the given namespace.
.. method:: findtext(match, default=None, namespaces=None) | trusted_official_docs | CPython Docs | optional mapping from namespace prefix to full name. Pass ``''`` as prefix to move all unprefixed tag names in the expression into the given namespace.
.. method:: findtext(match, default=None, namespaces=None) | optional mapping from namespace prefix to full name. Pass ``''`` as prefix to move all unprefixed tag names in the expression into the given namespace.
.. method:: findtext(match, default=None, namespaces=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d9ecae3a-8a44-4480-a288-a0d9afdae23c | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,021 | supabase-export-v2 | 11cda7f42ef37018 | A better way to search the namespaced XML example is to create a dictionary with your own prefixes and use those in the search functions::
ns = {'real_person': 'http://people.example.com',
'role': 'http://characters.example.com'} | trusted_official_docs | CPython Docs | A better way to search the namespaced XML example is to create a dictionary with your own prefixes and use those in the search functions::
ns = {'real_person': 'http://people.example.com',
'role': 'http://characters.example.com'} | A better way to search the namespaced XML example is to create a dictionary with your own prefixes and use those in the search functions::
ns = {'real_person': 'http://people.example.com',
'role': 'http://characters.example.com'} | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc6df834-f83b-4998-a180-cafe1c646e19 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,983 | supabase-export-v2 | 95620a67a203fc5d | .. note::
Not all elements of the XML input will end up as elements of the
parsed tree. Currently, this module skips over any XML comments,
processing instructions, and document type declarations in the
input. Nevertheless, trees built using this module's API rather
than parsing from XML text can have comments and ... | trusted_official_docs | CPython Docs | .. note::
Not all elements of the XML input will end up as elements of the
parsed tree. Currently, this module skips over any XML comments,
processing instructions, and document type declarations in the
input. Nevertheless, trees built using this module's API rather
than parsing from XML text can have comments and ... | .. note::
Not all elements of the XML input will end up as elements of the
parsed tree. Currently, this module skips over any XML comments,
processing instructions, and document type declarations in the
input. Nevertheless, trees built using this module's API rather
than parsing from XML text can have comments and ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd3106cb-1ea1-42e1-a73b-d0a0f0c753a9 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,103 | supabase-export-v2 | 7b598bd09d1c86c9 | *tag* is the subelement name. *attrib* is an optional dictionary, containing element attributes. *extra* contains additional attributes, given as keyword arguments. Returns an element instance.
.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`. | trusted_official_docs | CPython Docs | *tag* is the subelement name. *attrib* is an optional dictionary, containing element attributes. *extra* contains additional attributes, given as keyword arguments. Returns an element instance.
.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`. | *tag* is the subelement name. *attrib* is an optional dictionary, containing element attributes. *extra* contains additional attributes, given as keyword arguments. Returns an element instance.
.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
de8062bf-146f-4e5c-9d3d-478df577cb70 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,276 | supabase-export-v2 | 79ed72bc0f7fdd53 | .. method:: start_ns(prefix, uri)
Is called whenever the parser encounters a new namespace declaration,
before the ``start()`` callback for the opening element that defines it. *prefix* is ``''`` for the default namespace and the declared
namespace prefix name otherwise. *uri* is the namespace URI. | trusted_official_docs | CPython Docs | .. method:: start_ns(prefix, uri)
Is called whenever the parser encounters a new namespace declaration,
before the ``start()`` callback for the opening element that defines it. *prefix* is ``''`` for the default namespace and the declared
namespace prefix name otherwise. *uri* is the namespace URI. | .. method:: start_ns(prefix, uri)
Is called whenever the parser encounters a new namespace declaration,
before the ``start()`` callback for the opening element that defines it. *prefix* is ``''`` for the default namespace and the declared
namespace prefix name otherwise. *uri* is the namespace URI. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df8ddf40-a8b9-4cbe-8776-47594d526b30 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,297 | supabase-export-v2 | 48ae8472ef6eabcd | ``close()``. :class:`XMLParser` can be used not only for building a tree structure. This is an example of counting the maximum depth of an XML file::
>>> from xml.etree.ElementTree import XMLParser
>>> class MaxDepth: # The target object of the parser
... maxDepth = 0
... depth = 0
... def start(self, tag, attrib):... | trusted_official_docs | CPython Docs | ``close()``. :class:`XMLParser` can be used not only for building a tree structure. This is an example of counting the maximum depth of an XML file::
>>> from xml.etree.ElementTree import XMLParser
>>> class MaxDepth: # The target object of the parser
... maxDepth = 0
... depth = 0
... def start(self, tag, attrib):... | ``close()``. :class:`XMLParser` can be used not only for building a tree structure. This is an example of counting the maximum depth of an XML file::
>>> from xml.etree.ElementTree import XMLParser
>>> class MaxDepth: # The target object of the parser
... maxDepth = 0
... depth = 0
... def start(self, tag, attrib):... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e68dc19e-753a-4b23-8ab6-faa68d741b25 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,137 | supabase-export-v2 | 40c2d8c3518fe12e | If the **parse** attribute is omitted, it defaults to "xml". The href attribute is required.
To include a text document, use the ``{http://www.w3.org/2001/XInclude}include`` element, and set the **parse** attribute to "text": | trusted_official_docs | CPython Docs | If the **parse** attribute is omitted, it defaults to "xml". The href attribute is required.
To include a text document, use the ``{http://www.w3.org/2001/XInclude}include`` element, and set the **parse** attribute to "text": | If the **parse** attribute is omitted, it defaults to "xml". The href attribute is required.
To include a text document, use the ``{http://www.w3.org/2001/XInclude}include`` element, and set the **parse** attribute to "text": | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e9456e4f-0cd2-4f07-8e68-4fc6888ca46e | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,255 | supabase-export-v2 | 2ba80c385fff1a5a | element structure. You can use this class to build an element structure using a custom XML parser, or a parser for some other XML-like format.
*element_factory*, when given, must be a callable accepting two positional
arguments: a tag and a dict of attributes. It is expected to return a new
element instance. | trusted_official_docs | CPython Docs | element structure. You can use this class to build an element structure using a custom XML parser, or a parser for some other XML-like format.
*element_factory*, when given, must be a callable accepting two positional
arguments: a tag and a dict of attributes. It is expected to return a new
element instance. | element structure. You can use this class to build an element structure using a custom XML parser, or a parser for some other XML-like format.
*element_factory*, when given, must be a callable accepting two positional
arguments: a tag and a dict of attributes. It is expected to return a new
element instance. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea02e1b0-c4ec-447e-ae72-6109bd867066 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 9,996 | supabase-export-v2 | b2d44a8bb54f8e53 | of the current element. :meth:`Element.find` finds the *first* child with a particular tag, and :attr:`Element.text` accesses the element's text content. :meth:`Element.get` accesses the element's attributes::
>>> for country in root.findall('country'):
... rank = country.find('rank').text
... name = country.get('nam... | trusted_official_docs | CPython Docs | of the current element. :meth:`Element.find` finds the *first* child with a particular tag, and :attr:`Element.text` accesses the element's text content. :meth:`Element.get` accesses the element's attributes::
>>> for country in root.findall('country'):
... rank = country.find('rank').text
... name = country.get('nam... | of the current element. :meth:`Element.find` finds the *first* child with a particular tag, and :attr:`Element.text` accesses the element's text content. :meth:`Element.get` accesses the element's attributes::
>>> for country in root.findall('country'):
... rank = country.find('rank').text
... name = country.get('nam... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eaccfff4-af9f-4ffd-abc7-c78561b66cb3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,195 | supabase-export-v2 | d7ef8b7839d996d0 | .. method:: iter(tag=None)
Creates a tree :term:`iterator` with the current element as the root. The iterator iterates over this element and all elements below it, in
document (depth first) order. If *tag* is not ``None`` or ``'*'``, only
elements whose tag equals *tag* are returned from the iterator. If the
tree st... | trusted_official_docs | CPython Docs | .. method:: iter(tag=None)
Creates a tree :term:`iterator` with the current element as the root. The iterator iterates over this element and all elements below it, in
document (depth first) order. If *tag* is not ``None`` or ``'*'``, only
elements whose tag equals *tag* are returned from the iterator. If the
tree st... | .. method:: iter(tag=None)
Creates a tree :term:`iterator` with the current element as the root. The iterator iterates over this element and all elements below it, in
document (depth first) order. If *tag* is not ``None`` or ``'*'``, only
elements whose tag equals *tag* are returned from the iterator. If the
tree st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
edd5bb83-a741-43d2-b9d5-929609fa13b8 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,254 | supabase-export-v2 | 2b2e9ff67861a949 | .. class:: TreeBuilder(element_factory=None, *, comment_factory=None, \ pi_factory=None, insert_comments=False, insert_pis=False)
Generic element structure builder. This builder converts a sequence of
start, data, end, comment and pi method calls to a well-formed element
structure. You can use this class to build an ... | trusted_official_docs | CPython Docs | .. class:: TreeBuilder(element_factory=None, *, comment_factory=None, \ pi_factory=None, insert_comments=False, insert_pis=False)
Generic element structure builder. This builder converts a sequence of
start, data, end, comment and pi method calls to a well-formed element
structure. You can use this class to build an ... | .. class:: TreeBuilder(element_factory=None, *, comment_factory=None, \ pi_factory=None, insert_comments=False, insert_pis=False)
Generic element structure builder. This builder converts a sequence of
start, data, end, comment and pi method calls to a well-formed element
structure. You can use this class to build an ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eeb01d98-15d7-422d-8fe8-01f9d9a30741 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,207 | supabase-export-v2 | ca02aef11ecac7f3 | :class:`Element` objects also support the following sequence type methods for working with subelements: :meth:`~object.__delitem__`, :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`.
Caution: Elements with no subelements will test as ``False``. In a future
release of Python, all elemen... | trusted_official_docs | CPython Docs | :class:`Element` objects also support the following sequence type methods for working with subelements: :meth:`~object.__delitem__`, :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`.
Caution: Elements with no subelements will test as ``False``. In a future
release of Python, all elemen... | :class:`Element` objects also support the following sequence type methods for working with subelements: :meth:`~object.__delitem__`, :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`.
Caution: Elements with no subelements will test as ``False``. In a future
release of Python, all elemen... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f041e827-ed50-4630-ac9c-923d98cf5204 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,155 | supabase-export-v2 | c5347b7ea728d34c | Element class. This class defines the Element interface, and provides a reference implementation of this interface.
The element name, attribute names, and attribute values can be either
bytestrings or Unicode strings. *tag* is the element name. *attrib* is
an optional dictionary, containing element attributes. *extra... | trusted_official_docs | CPython Docs | Element class. This class defines the Element interface, and provides a reference implementation of this interface.
The element name, attribute names, and attribute values can be either
bytestrings or Unicode strings. *tag* is the element name. *attrib* is
an optional dictionary, containing element attributes. *extra... | Element class. This class defines the Element interface, and provides a reference implementation of this interface.
The element name, attribute names, and attribute values can be either
bytestrings or Unicode strings. *tag* is the element name. *attrib* is
an optional dictionary, containing element attributes. *extra... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f28e69ac-3b04-4b95-85ee-a440c798e2fa | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,312 | supabase-export-v2 | 8359c99dadea6ab3 | comment / processing instruction * ``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace mapping. * ``end-ns``: :const:`None` (this may change in a future version)
Events provided in a previous call to :meth:`read_events` will not be
yielded again. Events are consumed from the internal queue only when
... | trusted_official_docs | CPython Docs | comment / processing instruction * ``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace mapping. * ``end-ns``: :const:`None` (this may change in a future version)
Events provided in a previous call to :meth:`read_events` will not be
yielded again. Events are consumed from the internal queue only when
... | comment / processing instruction * ``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace mapping. * ``end-ns``: :const:`None` (this may change in a future version)
Events provided in a previous call to :meth:`read_events` will not be
yielded again. Events are consumed from the internal queue only when
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f2a79ed7-7f23-4b59-b649-7ca7b0e7eb77 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,293 | supabase-export-v2 | 07cf3e425f4c5a81 | .. method:: flush()
Triggers parsing of any previously fed unparsed data, which can be
used to ensure more immediate feedback, in particular with Expat >=2.6.0. The implementation of :meth:`flush` temporarily disables reparse deferral
with Expat (if currently enabled) and triggers a reparse. Disabling reparse deferra... | trusted_official_docs | CPython Docs | .. method:: flush()
Triggers parsing of any previously fed unparsed data, which can be
used to ensure more immediate feedback, in particular with Expat >=2.6.0. The implementation of :meth:`flush` temporarily disables reparse deferral
with Expat (if currently enabled) and triggers a reparse. Disabling reparse deferra... | .. method:: flush()
Triggers parsing of any previously fed unparsed data, which can be
used to ensure more immediate feedback, in particular with Expat >=2.6.0. The implementation of :meth:`flush` temporarily disables reparse deferral
with Expat (if currently enabled) and triggers a reparse. Disabling reparse deferra... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f488b8c5-dec8-4cb1-98fc-db4fefca0f7a | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,301 | supabase-export-v2 | aaba82c9c059f41d | .. class:: XMLPullParser(events=None)
A pull parser suitable for non-blocking applications. Its input-side API is
similar to that of :class:`XMLParser`, but instead of pushing calls to a
callback target, :class:`XMLPullParser` collects an internal list of parsing
events and lets the user read from it. *events* is a ... | trusted_official_docs | CPython Docs | .. class:: XMLPullParser(events=None)
A pull parser suitable for non-blocking applications. Its input-side API is
similar to that of :class:`XMLParser`, but instead of pushing calls to a
callback target, :class:`XMLPullParser` collects an internal list of parsing
events and lets the user read from it. *events* is a ... | .. class:: XMLPullParser(events=None)
A pull parser suitable for non-blocking applications. Its input-side API is
similar to that of :class:`XMLParser`, but instead of pushing calls to a
callback target, :class:`XMLPullParser` collects an internal list of parsing
events and lets the user read from it. *events* is a ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f69ac9fd-08a2-49e7-b557-b9bef16af524 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,019 | supabase-export-v2 | d7fe7b3553e76634 | search and explore this XML example is to manually add the URI to every tag or attribute in the xpath of a :meth:`~Element.find` or :meth:`~Element.findall`::
root = fromstring(xml_text)
for actor in root.findall('{http://people.example.com}actor'):
name = actor.find('{http://people.example.com}name')
print(name.tex... | trusted_official_docs | CPython Docs | search and explore this XML example is to manually add the URI to every tag or attribute in the xpath of a :meth:`~Element.find` or :meth:`~Element.findall`::
root = fromstring(xml_text)
for actor in root.findall('{http://people.example.com}actor'):
name = actor.find('{http://people.example.com}name')
print(name.tex... | search and explore this XML example is to manually add the URI to every tag or attribute in the xpath of a :meth:`~Element.find` or :meth:`~Element.findall`::
root = fromstring(xml_text)
for actor in root.findall('{http://people.example.com}actor'):
name = actor.find('{http://people.example.com}name')
print(name.tex... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8169a8a-bc4d-4a63-9ab4-0ba0694ec1c0 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,296 | supabase-export-v2 | 0bdafa7e30652466 | .. versionadded:: 3.13
:meth:`XMLParser.feed` calls *target*\'s ``start(tag, attrs_dict)`` method
for each opening tag, its ``end(tag)`` method for each closing tag, and data
is processed by method ``data(data)``. For further supported callback
methods, see the :class:`TreeBuilder` class. :meth:`XMLParser.close` cal... | trusted_official_docs | CPython Docs | .. versionadded:: 3.13
:meth:`XMLParser.feed` calls *target*\'s ``start(tag, attrs_dict)`` method
for each opening tag, its ``end(tag)`` method for each closing tag, and data
is processed by method ``data(data)``. For further supported callback
methods, see the :class:`TreeBuilder` class. :meth:`XMLParser.close` cal... | .. versionadded:: 3.13
:meth:`XMLParser.feed` calls *target*\'s ``start(tag, attrs_dict)`` method
for each opening tag, its ``end(tag)`` method for each closing tag, and data
is processed by method ``data(data)``. For further supported callback
methods, see the :class:`TreeBuilder` class. :meth:`XMLParser.close` cal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f878a2be-d637-463c-b0e3-156601550e31 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,289 | supabase-export-v2 | 63187d70f734a75e | .. method:: close()
Finishes feeding data to the parser. Returns the result of calling the
``close()`` method of the *target* passed during construction; by default,
this is the toplevel document element. | trusted_official_docs | CPython Docs | .. method:: close()
Finishes feeding data to the parser. Returns the result of calling the
``close()`` method of the *target* passed during construction; by default,
this is the toplevel document element. | .. method:: close()
Finishes feeding data to the parser. Returns the result of calling the
``close()`` method of the *target* passed during construction; by default,
this is the toplevel document element. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9047ff1-ff74-4c63-96a1-ffab6f2bec1d | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,060 | supabase-export-v2 | 160e5a15df6d34df | The configuration *options* are as follows:
- *with_comments*: set to true to include comments (default: false)
- *strip_text*: set to true to strip whitespace before and after text content
(default: false)
- *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}"
(default: false)
- *qname_awa... | trusted_official_docs | CPython Docs | The configuration *options* are as follows:
- *with_comments*: set to true to include comments (default: false)
- *strip_text*: set to true to strip whitespace before and after text content
(default: false)
- *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}"
(default: false)
- *qname_awa... | The configuration *options* are as follows:
- *with_comments*: set to true to include comments (default: false)
- *strip_text*: set to true to strip whitespace before and after text content
(default: false)
- *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}"
(default: false)
- *qname_awa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9dc2463-70f9-43fa-9f84-bded7efc5b54 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,286 | supabase-export-v2 | 6cf954065377a90f | .. class:: XMLParser(*, target=None, encoding=None)
This class is the low-level building block of the module. It uses
:mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It can
be fed XML data incrementally with the :meth:`feed` method, and parsing
events are translated to a push API - by invoking ca... | trusted_official_docs | CPython Docs | .. class:: XMLParser(*, target=None, encoding=None)
This class is the low-level building block of the module. It uses
:mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It can
be fed XML data incrementally with the :meth:`feed` method, and parsing
events are translated to a push API - by invoking ca... | .. class:: XMLParser(*, target=None, encoding=None)
This class is the low-level building block of the module. It uses
:mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It can
be fed XML data incrementally with the :meth:`feed` method, and parsing
events are translated to a push API - by invoking ca... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc2cd4f5-b2cb-4d22-9cb4-8ec71aa084a6 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,325 | supabase-export-v2 | bd0adb84f0b481b4 | .. rubric:: Footnotes
.. [1] The encoding string included in XML output should conform to the
appropriate standards. For example, "UTF-8" is valid, but "UTF8" is
not. See https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl
and https://www.iana.org/assignments/character-sets/character-sets.xhtml. | trusted_official_docs | CPython Docs | .. rubric:: Footnotes
.. [1] The encoding string included in XML output should conform to the
appropriate standards. For example, "UTF-8" is valid, but "UTF8" is
not. See https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl
and https://www.iana.org/assignments/character-sets/character-sets.xhtml. | .. rubric:: Footnotes
.. [1] The encoding string included in XML output should conform to the
appropriate standards. For example, "UTF-8" is valid, but "UTF8" is
not. See https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl
and https://www.iana.org/assignments/character-sets/character-sets.xhtml. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc3252b7-ba3d-4164-99b4-fdfed4beaae3 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,119 | supabase-export-v2 | 854a3b6c3f6fc1ec | .. function:: XMLID(text, parser=None)
Parses an XML section from a string constant, and also returns a dictionary
which maps from element id:s to elements. *text* is a string containing XML
data. *parser* is an optional parser instance. If not given, the standard
:class:`XMLParser` parser is used. Returns a tuple c... | trusted_official_docs | CPython Docs | .. function:: XMLID(text, parser=None)
Parses an XML section from a string constant, and also returns a dictionary
which maps from element id:s to elements. *text* is a string containing XML
data. *parser* is an optional parser instance. If not given, the standard
:class:`XMLParser` parser is used. Returns a tuple c... | .. function:: XMLID(text, parser=None)
Parses an XML section from a string constant, and also returns a dictionary
which maps from element id:s to elements. *text* is a string containing XML
data. *parser* is an optional parser instance. If not given, the standard
:class:`XMLParser` parser is used. Returns a tuple c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe15aa99-9cbe-4e8b-a881-1be1b29ac5f7 | CPython Docs | file://datasets/cpython/Doc/library/xml.etree.elementtree.rst | unknown | d81dc7a8-b7b0-48c6-8470-b95d3f6d7eca | 10,222 | supabase-export-v2 | a019857a26c86de8 | .. method:: _setroot(element)
Replaces the root element for this tree. This discards the current
contents of the tree, and replaces it with the given element. Use with
care. *element* is an element instance. | trusted_official_docs | CPython Docs | .. method:: _setroot(element)
Replaces the root element for this tree. This discards the current
contents of the tree, and replaces it with the given element. Use with
care. *element* is an element instance. | .. method:: _setroot(element)
Replaces the root element for this tree. This discards the current
contents of the tree, and replaces it with the given element. Use with
care. *element* is an element instance. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
03799ed3-4ace-41ff-86c5-82af0fb79848 | CPython Docs | file://datasets/cpython/Doc/library/compileall.rst | unknown | 8e0da5db-9761-4b3c-a376-5aba69513941 | 10,398 | supabase-export-v2 | 44c93404a0d7d7fa | .. versionchanged:: 3.8 Setting *workers* to 0 now chooses the optimal number of cores.
.. versionchanged:: 3.9
Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments. Default value of *maxlevels* was changed from ``10`` to ``sys.getrecursionlimit()`` | trusted_official_docs | CPython Docs | .. versionchanged:: 3.8 Setting *workers* to 0 now chooses the optimal number of cores.
.. versionchanged:: 3.9
Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments. Default value of *maxlevels* was changed from ``10`` to ``sys.getrecursionlimit()`` | .. versionchanged:: 3.8 Setting *workers* to 0 now chooses the optimal number of cores.
.. versionchanged:: 3.9
Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments. Default value of *maxlevels* was changed from ``10`` to ``sys.getrecursionlimit()`` | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.