Element I want to define:
<feature_ref id="0"/>
Code I've put in my XSD file:
<xs:attribute name="id" type="xs:integer"/>
<xs:element name="feature_ref" type="xs:string">
<xs:complexType>
<xs:attribute ref="id"/>
</xs:complexType>
</xs:element>
Is there a way I can specify in my XSD that this element should be self-closing?
Self-closing elements are syntaxic sugar for the same value. For the same reason you cannot control the sequence of attributes, or the whitespace between attributes, self-closing cannot be defined with XSD.
In other words:
<feature_ref id="0"/>
is exactly the same as
<feature_ref id="0"></feature_ref>
See the W3 specifications: http://www.w3.org/TR/REC-xml/#sec-starttags
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With