@@ -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.
@@ -888,11 +887,22 @@ Element Objects
888887 Element class. This class defines the Element interface, and provides a
889888 reference implementation of this interface.
890889
891- The element name, attribute names, and attribute values can be either
892- bytestrings or Unicode strings. *tag * is the element name. *attrib * is
890+ *tag * is the element name. *attrib * is
893891 an optional dictionary, containing element attributes. *extra * contains
894892 additional attributes, given as keyword arguments.
895893
894+ The element name and the attribute names and values are strings or
895+ :class: `QName ` instances, and the text and the tail are strings or
896+ ``None ``.
897+ The element name can also be :func: `Comment ` or
898+ :func: `ProcessingInstruction `, which are used for special elements.
899+ If it is ``None ``, the element itself is not serialized: only its text
900+ and its children are written, and its attributes are ignored.
901+ This can be used for a fragment which contains several elements.
902+ With ``method="html" `` the attribute value can also be ``None ``,
903+ which produces an empty attribute (such as ``checked ``).
904+ Other objects can be stored in the tree, but they cannot be serialized.
905+
896906 .. versionchanged :: 3.15
897907 *attrib * can now be a :class: `frozendict `.
898908
@@ -958,14 +968,12 @@ Element Objects
958968
959969 .. method :: items()
960970
961- Returns the element attributes as a sequence of (name, value) pairs. The
962- attributes are returned in an arbitrary order.
971+ Returns the element attributes as (name, value) pairs.
963972
964973
965974 .. method :: keys()
966975
967- Returns the elements attribute names as a list. The names are returned
968- in an arbitrary order.
976+ Returns the element attribute names.
969977
970978
971979 .. method :: set(key, value)
@@ -1296,8 +1304,7 @@ TreeBuilder Objects
12961304
12971305 .. method :: data(data)
12981306
1299- Adds text to the current element. *data * is a string. This should be
1300- either a bytestring, or a Unicode string.
1307+ Adds text to the current element. *data * is a string.
13011308
13021309
13031310 .. method :: end(tag)
@@ -1400,7 +1407,8 @@ XMLParser Objects
14001407
14011408 .. method :: feed(data)
14021409
1403- Feeds data to the parser. *data * is encoded data.
1410+ Feeds data to the parser. *data * is a string
1411+ or encoded data (:class: `bytes ` or a :term: `bytes-like object `).
14041412
14051413
14061414 .. method :: flush()
@@ -1479,7 +1487,8 @@ XMLPullParser Objects
14791487
14801488 .. method :: feed(data)
14811489
1482- Feed the given bytes data to the parser.
1490+ Feed the given data to the parser. *data * is a string
1491+ or encoded data (:class: `bytes ` or a :term: `bytes-like object `).
14831492
14841493 .. method :: flush()
14851494
0 commit comments