Skip to content

Document

Holds a complete XML document with exactly one root element.

Children may be elements, comments, or XML whitespace strings. Exactly one child must be an element. Invalid child types raise TypeError; invalid text or a root count other than one raises ValueError.

Fields

children @ MutSeq[Node] [get]

Mutable view of the document's children in order.

Removing the root or clearing the view raises StateError. Replacement and insertion must preserve exactly one root or raise ValueError. Failed operations leave the children unchanged.

root @ Element [get, set]

The root element. Assignment replaces it in place.