@@ -551,10 +551,9 @@ Functions
551551.. function :: Comment(text=None)
552552
553553 Comment element factory. This factory function creates a special element
554- that will be serialized as an XML comment by the standard serializer. The
555- comment string can be either a bytestring or a Unicode string. *text * is a
556- string containing the comment string. Returns an element instance
557- representing a comment.
554+ that will be serialized as an XML comment by the standard serializer.
555+ *text * is a string containing the comment string.
556+ Returns an element instance representing a comment.
558557
559558 Note that :class: `XMLParser ` skips over comments in the input
560559 instead of creating comment objects for them. An :class: `ElementTree ` will
@@ -621,10 +620,11 @@ Functions
621620 ``"pi" ``, ``"start-ns" `` and ``"end-ns" ``
622621 (the "ns" events are used to get detailed namespace
623622 information). If *events * is omitted, only ``"end" `` events are reported.
624- *parser * is an optional parser instance. If not given, the standard
625- :class: `XMLParser ` parser is used. *parser * must be a subclass of
626- :class: `XMLParser ` and can only use the default :class: `TreeBuilder ` as a
627- target. Returns an :term: `iterator ` providing ``(event, elem) `` pairs;
623+ *parser * is an optional parser instance.
624+ If not given, the standard :class: `XMLParser ` parser is used.
625+ *parser * must be an instance of :class: `XMLParser ` or its subclass
626+ and can only use the default :class: `TreeBuilder ` as a target.
627+ Returns an :term: `iterator ` providing ``(event, elem) `` pairs;
628628 it has a ``root `` attribute that references the root element of the
629629 resulting XML tree once *source * is fully read.
630630 The iterator has the :meth: `!close ` method that closes the internal
@@ -696,8 +696,7 @@ Functions
696696 Subelement factory. This function creates an element instance, and appends
697697 it to an existing element.
698698
699- The element name, attribute names, and attribute values can be either
700- bytestrings or Unicode strings. *parent * is the parent element. *tag * is
699+ *parent * is the parent element. *tag * is
701700 the subelement name. *attrib * is an optional dictionary, containing element
702701 attributes. *extra * contains additional attributes, given as keyword
703702 arguments. Returns an element instance.
@@ -895,11 +894,22 @@ Element Objects
895894 Element class. This class defines the Element interface, and provides a
896895 reference implementation of this interface.
897896
898- The element name, attribute names, and attribute values can be either
899- bytestrings or Unicode strings. *tag * is the element name. *attrib * is
897+ *tag * is the element name. *attrib * is
900898 an optional dictionary, containing element attributes. *extra * contains
901899 additional attributes, given as keyword arguments.
902900
901+ The element name and the attribute names and values are strings or
902+ :class: `QName ` instances, and the text and the tail are strings or
903+ ``None ``.
904+ The element name can also be :func: `Comment ` or
905+ :func: `ProcessingInstruction `, which are used for special elements.
906+ If it is ``None ``, the element itself is not serialized: only its text
907+ and its children are written, and its attributes are ignored.
908+ This can be used for a fragment which contains several elements.
909+ With ``method="html" `` the attribute value can also be ``None ``,
910+ which produces an empty attribute (such as ``checked ``).
911+ Other objects can be stored in the tree, but they cannot be serialized.
912+
903913 .. versionchanged :: 3.15
904914 *attrib * can now be a :class: `frozendict `.
905915
@@ -965,14 +975,12 @@ Element Objects
965975
966976 .. method :: items()
967977
968- Returns the element attributes as a sequence of (name, value) pairs. The
969- attributes are returned in an arbitrary order.
978+ Returns the element attributes as (name, value) pairs.
970979
971980
972981 .. method :: keys()
973982
974- Returns the elements attribute names as a list. The names are returned
975- in an arbitrary order.
983+ Returns the element attribute names.
976984
977985
978986 .. method :: set(key, value)
@@ -1313,8 +1321,7 @@ TreeBuilder Objects
13131321
13141322 .. method :: data(data)
13151323
1316- Adds text to the current element. *data * is a string. This should be
1317- either a bytestring, or a Unicode string.
1324+ Adds text to the current element. *data * is a string.
13181325
13191326
13201327 .. method :: end(tag)
@@ -1417,7 +1424,8 @@ XMLParser Objects
14171424
14181425 .. method :: feed(data)
14191426
1420- Feeds data to the parser. *data * is encoded data.
1427+ Feeds data to the parser. *data * is a string
1428+ or encoded data (:class: `bytes ` or a :term: `bytes-like object `).
14211429
14221430
14231431 .. method :: flush()
@@ -1496,7 +1504,8 @@ XMLPullParser Objects
14961504
14971505 .. method :: feed(data)
14981506
1499- Feed the given bytes data to the parser.
1507+ Feed the given data to the parser. *data * is a string
1508+ or encoded data (:class: `bytes ` or a :term: `bytes-like object `).
15001509
15011510 .. method :: flush()
15021511
0 commit comments