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:
is exactly the same as
See the W3 specifications: http://www.w3.org/TR/REC-xml/#sec-starttags