Skip to content

XML: Allow children of ElementSpec to also be ElementSpec #1590

@Mafus1

Description

@Mafus1

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions