title: XML validation for empty decimal element with precision attribute
body: <p>I have an issue validating an empty element against an XSD which contains the definition below. If the total_amt comes out to be empty, we want an empty element in the XML document, like </p>
  
  <pre><code>&lt;total_amt/&gt;
  </code></pre>
  
  <p>So I have created a custom datatype in XSD as shown below: </p>
  
  <pre><code>&lt;xs:simpleType name="decimal-or-empty"&gt;
    &lt;xs:union memberTypes="xs:decimal empty-string" /&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:simpleType name="empty-string"&gt;
    &lt;xs:restriction base="xs:string"&gt;
      &lt;xs:enumeration value="" /&gt;
    &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  </code></pre>
  
  <p>And the XSD definition of the element is shown below. </p>
  
  <pre><code>&lt;xs:element name = "total_amt" 
              nillable="false" 
              minOccurs="0" 
              type="decimal-or-empty"&gt;
       &lt;xs:complexType&gt;
         &lt;xs:SimpleContent&gt;
           &lt;xs:extension base="xs:decimal"&gt;
              &lt;xs:attribute name="precision" 
                            type="xs:integer"/&gt;
          &lt;/xs:extension&gt;
        &lt;/xs:SimpleContent&gt;
     &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>If I remove the precision attribute in the above XSD, then it validates the custom data type and it works well with empty value </p>
  
  <pre><code>&lt;xs:element name = "total_amt" 
              nillable="false" 
              minOccurs="0" 
              type="decimal-or-empty"&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>but when I define the <code>precision</code> attribute, the result is always that the XML instance is invalid.</p>
  
  <p>So, Can anyone please help me in writing XSD where I can put the <code>precision</code> attribute and still validate the XML when the value of the total_amt is empty?</p>