summaryrefslogtreecommitdiffstats
path: root/Doc/library/xml.etree.elementtree.rst
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-04-11 14:53:27 (GMT)
committerGitHub <noreply@github.com>2024-04-11 14:53:27 (GMT)
commita3f1e980c3c09d499cfa5c633c9187ccad410986 (patch)
tree294d5a0e44cd6e23bbd075200b604d90cbb6a5a9 /Doc/library/xml.etree.elementtree.rst
parenta4541a60807af2166811e01437477efcbf9d7b86 (diff)
downloadcpython-a3f1e980c3c09d499cfa5c633c9187ccad410986.zip
cpython-a3f1e980c3c09d499cfa5c633c9187ccad410986.tar.gz
cpython-a3f1e980c3c09d499cfa5c633c9187ccad410986.tar.bz2
[3.12] gh-101549: fix documentation of xml.etree.ElementInclude (GH-101550) (#117754)
Co-authored-by: Mikhail B <55960560+mbel0@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Diffstat (limited to 'Doc/library/xml.etree.elementtree.rst')
-rw-r--r--Doc/library/xml.etree.elementtree.rst35
1 files changed, 15 insertions, 20 deletions
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst
index 09aa81c..87c57db 100644
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -835,33 +835,28 @@ Functions
.. module:: xml.etree.ElementInclude
-.. function:: xml.etree.ElementInclude.default_loader( href, parse, encoding=None)
- :module:
+.. function:: default_loader(href, parse, encoding=None)
- Default loader. This default loader reads an included resource from disk. *href* is a URL.
- *parse* is for parse mode either "xml" or "text". *encoding*
- is an optional text encoding. If not given, encoding is ``utf-8``. Returns the
- expanded resource. If the parse mode is ``"xml"``, this is an ElementTree
- instance. If the parse mode is "text", this is a Unicode string. If the
- loader fails, it can return None or raise an exception.
+ Default loader. This default loader reads an included resource from disk.
+ *href* is a URL. *parse* is for parse mode either "xml" or "text".
+ *encoding* is an optional text encoding. If not given, encoding is ``utf-8``.
+ Returns the expanded resource.
+ If the parse mode is ``"xml"``, this is 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:: xml.etree.ElementInclude.include( elem, loader=None, base_url=None, \
- max_depth=6)
- :module:
+.. function:: include(elem, loader=None, base_url=None, max_depth=6)
- This function expands XInclude directives. *elem* is the root element. *loader* is
- an optional resource loader. If omitted, it defaults to :func:`default_loader`.
+ 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 resource loader. If omitted, it defaults to :func:`default_loader`.
If given, it should be a callable that implements the same interface as
:func:`default_loader`. *base_url* is base URL of the original file, to resolve
relative include file references. *max_depth* is the maximum number of recursive
- inclusions. Limited to reduce the risk of malicious content explosion. Pass a
- negative value to disable the limitation.
-
- Returns the expanded resource. If the parse mode is
- ``"xml"``, this is an ElementTree instance. If the parse mode is "text",
- this is a Unicode string. If the loader fails, it can return None or
- raise an exception.
+ inclusions. Limited to reduce the risk of malicious content explosion.
+ Pass ``None`` to disable the limitation.
.. versionchanged:: 3.9
Added the *base_url* and *max_depth* parameters.