title: XSD elements with same name but different types
body: <p>I need to write a XSD which will validate the attribute as well as the value of the element. So far I am able to validate the attributes but not the value. Thanks for your help in advance.</p>
  
  <p>My XML:</p>
  
  <pre><code>&lt;params&gt;
      &lt;param dataType="java.lang.String"&gt;12A&lt;/param&gt;
      &lt;param dataType="java.lang.Integer"&gt;6455&lt;/param&gt;
      &lt;param dataType="oracle.jbo.domain.Date"&gt;2014-10-01&lt;/param&gt;
      &lt;param dataType="oracle.jbo.domain.Date"&gt;2018-10-01&lt;/param&gt;
      &lt;param dataType="java.lang.String"&gt;H1&lt;/param&gt;
      &lt;param dataType="java.lang.String"&gt;4235AS&lt;/param&gt;
      &lt;param dataType="java.lang.String"&gt;5aZ&lt;/param&gt;
      &lt;param dataType="java.lang.String"&gt;q2w&lt;/param&gt;
      &lt;param dataType="java.lang.Integer"&gt;10&lt;/param&gt;
      &lt;param dataType="java.lang.Integer"&gt;3&lt;/param&gt;
  &lt;/params&gt;
  </code></pre>
  
  <p>My XSD</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
             xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="params"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element maxOccurs="10" 
                      name="param" type="paramType" /&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  
    &lt;xs:complexType name="paramType"&gt;
      &lt;xs:simpleContent&gt;
        &lt;xs:extension base="xs:string"&gt;
          &lt;xs:attribute name="dataType" type="validAttributeType" use="optional" /&gt;
        &lt;/xs:extension&gt;
      &lt;/xs:simpleContent&gt;
    &lt;/xs:complexType&gt;
  
    &lt;xs:simpleType name="validAttributeType"&gt;
      &lt;xs:restriction base="xs:string"&gt;
        &lt;xs:enumeration value="java.lang.String" /&gt;
        &lt;xs:enumeration value="java.lang.Integer" /&gt;
        &lt;xs:enumeration value="oracle.jbo.domain.Date" /&gt;
  
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>So my need is, if the dataType says Integer it should only accept numbers as value or if it says date, then the value should be date not anything else.</p>