v0.4 preserves inter-element whitespace as Text nodes (XML 1.0 §2.10 conformance: a processor must pass all non-markup characters through). A consequence is that children(node) on pretty-printed documents interleaves whitespace Text nodes with elements, and dependents that iterate or index children expecting elements need a nodetype filter. Three v0.4 migrations already hit exactly this pattern:
Proposal: add an explicit element-only accessor pair, mirroring EzXML's eachelement/elements:
eachelement(node) — lazy iterator over the child elements of a Node/LazyNode (skipping Text, Comment, ProcessingInstruction, …), built on children/eachchildnode;
elements(node) — the collected Vector counterpart.
Non-breaking v0.4.x addition. It gives dependents the pre-0.4 "children are elements" convenience back as an explicit, conformant idiom — for el in eachelement(node) — instead of an implicit assumption about whitespace handling. Happy to open the PR if there's agreement on the names.
v0.4 preserves inter-element whitespace as
Textnodes (XML 1.0 §2.10 conformance: a processor must pass all non-markup characters through). A consequence is thatchildren(node)on pretty-printed documents interleaves whitespaceTextnodes with elements, and dependents that iterate or index children expecting elements need anodetypefilter. Three v0.4 migrations already hit exactly this pattern:node[2]) and unfilteredchildreniteration — silently parsed 0 observations on 0.4 until filtered.Proposal: add an explicit element-only accessor pair, mirroring EzXML's
eachelement/elements:eachelement(node)— lazy iterator over the child elements of aNode/LazyNode(skippingText,Comment,ProcessingInstruction, …), built onchildren/eachchildnode;elements(node)— the collectedVectorcounterpart.Non-breaking v0.4.x addition. It gives dependents the pre-0.4 "children are elements" convenience back as an explicit, conformant idiom —
for el in eachelement(node)— instead of an implicit assumption about whitespace handling. Happy to open the PR if there's agreement on the names.