type

XML.Value

type Value = string | Element

An element in the compact shape parse returns by default: its character data (a string) when it has no attributes and no child elements, otherwise an Element.

Referenced types

interface Element

An element that has attributes or child elements, in the compact shape.

  • "@name" — one per attribute, holding its value.
  • "#text" — the element's own character data, exactly, when it has any: its text runs concatenated, leaving out only whitespace-only runs that sit between child elements (layout).
  • any other key — a child element name, holding that child's Value, or an array of them when the name occurs more than once in this element.

Keys are in document order: attributes first, then child names and "#text" in order of first appearance. @ and # cannot begin an XML name, so these keys never collide with element names.