Question

I have xml that could be

<group>
  <location/>
  <persistent/>
</group>

or

<group>
  <ui-location/>
  <persistent/>
</group>

Is there a way to have a wildcard for ui- part or is there some way to say that the element that appear there can be either location or ui-location?

Was it helpful?

Solution

in answer to the 2nd part of your question. You can use xsd:choice:

element that appear there can be either location or ui-location

<xsd:sequence>
    <xsd:choice minOccurs="1" maxOccurs="1">
        <xsd:element name="location" type="xsd:string"/>
        <xsd:element name="ui-location" type="xsd:string"/>
    </xsd:choice>
</xsd:sequence>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top