XML: Allow children of ElementSpec to also be ElementSpec
Author: Mafus1Created Jul 16, 2025Updated Apr 15, 2026
I would like to provide auto complete for children of elements, where the name of the children is not unique.
In the example below, the elements infos are used for cars and bikes, but are completely different types of information. XSD allows this by specifying a type for an element as well as a name.
<car>
<infos>
<cc>3000</cc>
</infos>
</car>
<bike>
<infos>
<gears>21</gears>
</infos>
</bike>Since I can only define an array of names as the children of ElementSpec, it is not possible to have a infos element that is different for cars vs. bikes.
I would suggest expanding the children property to be of type: (string | ElementSpec)[], or allow a child to be a reference to a type, not just a name.
Is that something you are willing to implement?
Source: codemirror/dev