@@ -106,6 +106,19 @@ Children are nested, and we can access specific child nodes by index::
106106 '2008'
107107
108108
109+ .. note ::
110+
111+ Not all elements of the XML input will end up as elements of the
112+ parsed tree. Currently, this module skips over any XML comments,
113+ processing instructions, and document type declarations in the
114+ input. Nevertheless, trees built using this module's API rather
115+ than parsing from XML text can have comments and processing
116+ instructions in them; they will be included when generating XML
117+ output. A document type declaration may be accessed by passing a
118+ custom :class: `TreeBuilder ` instance to the :class: `XMLParser `
119+ constructor.
120+
121+
109122.. _elementtree-pull-parsing :
110123
111124Pull API for non-blocking parsing
@@ -381,6 +394,10 @@ Functions
381394 string containing the comment string. Returns an element instance
382395 representing a comment.
383396
397+ Note that :class: `XMLParser ` skips over comments in the input
398+ instead of creating comment objects for them. An :class: `ElementTree ` will
399+ only contain comment nodes if they have been inserted into to
400+ the tree using one of the :class: `Element ` methods.
384401
385402.. function :: dump(elem)
386403
@@ -461,6 +478,11 @@ Functions
461478 containing the PI target. *text * is a string containing the PI contents, if
462479 given. Returns an element instance, representing a processing instruction.
463480
481+ Note that :class: `XMLParser ` skips over processing instructions
482+ in the input instead of creating comment objects for them. An
483+ :class: `ElementTree ` will only contain processing instruction nodes if
484+ they have been inserted into to the tree using one of the
485+ :class: `Element ` methods.
464486
465487.. function :: register_namespace(prefix, uri)
466488
0 commit comments