@@ -580,10 +580,9 @@ Functions
580580.. function :: Comment(text=None)
581581
582582 Comment element factory. This factory function creates a special element
583- that will be serialized as an XML comment by the standard serializer. The
584- comment string can be either a bytestring or a Unicode string. *text * is a
585- string containing the comment string. Returns an element instance
586- representing a comment.
583+ that will be serialized as an XML comment by the standard serializer.
584+ *text * is a string containing the comment string.
585+ Returns an element instance representing a comment.
587586
588587 Note that :class: `XMLParser ` skips over comments in the input
589588 instead of creating comment objects for them. An :class: `ElementTree ` will
@@ -650,10 +649,11 @@ Functions
650649 ``"pi" ``, ``"start-ns" `` and ``"end-ns" ``
651650 (the "ns" events are used to get detailed namespace
652651 information). If *events * is omitted, only ``"end" `` events are reported.
653- *parser * is an optional parser instance. If not given, the standard
654- :class: `XMLParser ` parser is used. *parser * must be a subclass of
655- :class: `XMLParser ` and can only use the default :class: `TreeBuilder ` as a
656- target. Returns an :term: `iterator ` providing ``(event, elem) `` pairs;
652+ *parser * is an optional parser instance.
653+ If not given, the standard :class: `XMLParser ` parser is used.
654+ *parser * must be an instance of :class: `XMLParser ` or its subclass
655+ and can only use the default :class: `TreeBuilder ` as a target.
656+ Returns an :term: `iterator ` providing ``(event, elem) `` pairs;
657657 it has a ``root `` attribute that references the root element of the
658658 resulting XML tree once *source * is fully read.
659659 The iterator has the :meth: `!close ` method that closes the internal
@@ -729,8 +729,7 @@ Functions
729729 Subelement factory. This function creates an element instance, and appends
730730 it to an existing element.
731731
732- The element name, attribute names, and attribute values can be either
733- bytestrings or Unicode strings. *parent * is the parent element. *tag * is
732+ *parent * is the parent element. *tag * is
734733 the subelement name. *attrib * is an optional dictionary, containing element
735734 attributes. *extra * contains additional attributes, given as keyword
736735 arguments. Returns an element instance.
@@ -921,11 +920,22 @@ Element Objects
921920 Element class. This class defines the Element interface, and provides a
922921 reference implementation of this interface.
923922
924- The element name, attribute names, and attribute values can be either
925- bytestrings or Unicode strings. *tag * is the element name. *attrib * is
923+ *tag * is the element name. *attrib * is
926924 an optional dictionary, containing element attributes. *extra * contains
927925 additional attributes, given as keyword arguments.
928926
927+ The element name and the attribute names and values are strings or
928+ :class: `QName ` instances, and the text and the tail are strings or
929+ ``None ``.
930+ The element name can also be :func: `Comment ` or
931+ :func: `ProcessingInstruction `, which are used for special elements.
932+ If it is ``None ``, the element itself is not serialized: only its text
933+ and its children are written, and its attributes are ignored.
934+ This can be used for a fragment which contains several elements.
935+ With ``method="html" `` the attribute value can also be ``None ``,
936+ which produces an empty attribute (such as ``checked ``).
937+ Other objects can be stored in the tree, but they cannot be serialized.
938+
929939 .. versionchanged :: 3.15
930940 *attrib * can now be a :class: `frozendict `.
931941
@@ -991,14 +1001,12 @@ Element Objects
9911001
9921002 .. method :: items()
9931003
994- Returns the element attributes as a sequence of (name, value) pairs. The
995- attributes are returned in an arbitrary order.
1004+ Returns the element attributes as (name, value) pairs.
9961005
9971006
9981007 .. method :: keys()
9991008
1000- Returns the elements attribute names as a list. The names are returned
1001- in an arbitrary order.
1009+ Returns the element attribute names.
10021010
10031011
10041012 .. method :: set(key, value)
@@ -1329,8 +1337,7 @@ TreeBuilder Objects
13291337
13301338 .. method :: data(data)
13311339
1332- Adds text to the current element. *data * is a string. This should be
1333- either a bytestring, or a Unicode string.
1340+ Adds text to the current element. *data * is a string.
13341341
13351342
13361343 .. method :: end(tag)
@@ -1433,7 +1440,8 @@ XMLParser Objects
14331440
14341441 .. method :: feed(data)
14351442
1436- Feeds data to the parser. *data * is encoded data.
1443+ Feeds data to the parser. *data * is a string
1444+ or encoded data (:class: `bytes ` or a :term: `bytes-like object `).
14371445
14381446
14391447 .. method :: flush()
@@ -1512,7 +1520,8 @@ XMLPullParser Objects
15121520
15131521 .. method :: feed(data)
15141522
1515- Feed the given bytes data to the parser.
1523+ Feed the given data to the parser. *data * is a string
1524+ or encoded data (:class: `bytes ` or a :term: `bytes-like object `).
15161525
15171526 .. method :: flush()
15181527
0 commit comments