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