title: How to write XML Schema to require self-closing tag in XML
body: <p>The below XSD I have page-count element with attributes.</p>
  
  <pre><code>&lt;xs:element name="counts"&gt;
        &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
            &lt;xs:element name="page-count"&gt;
                &lt;xs:complexType&gt;
                    &lt;xs:simpleContent&gt;
                        &lt;xs:extension base="xs:NMTOKEN"&gt;
                            &lt;xs:attribute name="count" use="required" type="xs:NCName"/&gt;
                        &lt;/xs:extension&gt;
                    &lt;/xs:simpleContent&gt;
                &lt;/xs:complexType&gt;
            &lt;/xs:element&gt;
        &lt;/xs:sequence&gt;  
      &lt;/xs:complexType&gt;    
    &lt;/xs:element&gt;  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>My problem is if I have <code>&lt;page-count id="blabla" name="count"&gt;&lt;/page-count&gt;</code> in XML
  there is no content in the page-count tag.   So I want to self-close the tag with attribute like <code>&lt;page-count id="blabla" name="count" /&gt;</code></p>
  
  <p>I don't know how write a schema for this allowing self close the page-count tag. </p>