@@ -835,33 +835,28 @@ Functions
835
835
836
836
.. module :: xml.etree.ElementInclude
837
837
838
- .. function :: xml.etree.ElementInclude.default_loader( href, parse, encoding=None)
839
- :module:
838
+ .. function :: default_loader(href, parse, encoding=None)
840
839
841
- Default loader. This default loader reads an included resource from disk. *href * is a URL.
842
- *parse * is for parse mode either "xml" or "text". *encoding *
843
- is an optional text encoding. If not given, encoding is ``utf-8 ``. Returns the
844
- expanded resource. If the parse mode is ``"xml" ``, this is an ElementTree
845
- instance. If the parse mode is "text", this is a Unicode string. If the
846
- loader fails, it can return None or raise an exception.
840
+ Default loader. This default loader reads an included resource from disk.
841
+ *href * is a URL. *parse * is for parse mode either "xml" or "text".
842
+ *encoding * is an optional text encoding. If not given, encoding is ``utf-8 ``.
843
+ Returns the expanded resource.
844
+ If the parse mode is ``"xml" ``, this is an :class: `~xml.etree.ElementTree.Element ` instance.
845
+ If the parse mode is ``"text" ``, this is a string.
846
+ If the loader fails, it can return ``None `` or raise an exception.
847
847
848
848
849
- .. function :: xml.etree.ElementInclude.include( elem, loader=None, base_url=None, \
850
- max_depth=6)
851
- :module:
849
+ .. function :: include(elem, loader=None, base_url=None, max_depth=6)
852
850
853
- This function expands XInclude directives. *elem * is the root element. *loader * is
854
- an optional resource loader. If omitted, it defaults to :func: `default_loader `.
851
+ This function expands XInclude directives in-place in tree pointed by *elem *.
852
+ *elem * is either the root :class: `~xml.etree.ElementTree.Element ` or an
853
+ :class: `~xml.etree.ElementTree.ElementTree ` instance to find such element.
854
+ *loader * is an optional resource loader. If omitted, it defaults to :func: `default_loader `.
855
855
If given, it should be a callable that implements the same interface as
856
856
:func: `default_loader `. *base_url * is base URL of the original file, to resolve
857
857
relative include file references. *max_depth * is the maximum number of recursive
858
- inclusions. Limited to reduce the risk of malicious content explosion. Pass a
859
- negative value to disable the limitation.
860
-
861
- Returns the expanded resource. If the parse mode is
862
- ``"xml" ``, this is an ElementTree instance. If the parse mode is "text",
863
- this is a Unicode string. If the loader fails, it can return None or
864
- raise an exception.
858
+ inclusions. Limited to reduce the risk of malicious content explosion.
859
+ Pass ``None `` to disable the limitation.
865
860
866
861
.. versionchanged :: 3.9
867
862
Added the *base_url * and *max_depth * parameters.
0 commit comments