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.
My XML:
<params>
    <param dataType="java.lang.String">12A</param>
    <param dataType="java.lang.Integer">6455</param>
    <param dataType="oracle.jbo.domain.Date">2014-10-01</param>
    <param dataType="oracle.jbo.domain.Date">2018-10-01</param>
    <param dataType="java.lang.String">H1</param>
    <param dataType="java.lang.String">4235AS</param>
    <param dataType="java.lang.String">5aZ</param>
    <param dataType="java.lang.String">q2w</param>
    <param dataType="java.lang.Integer">10</param>
    <param dataType="java.lang.Integer">3</param>
</params>
My XSD
<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="params">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="10" 
                    name="param" type="paramType" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="paramType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="dataType" type="validAttributeType" use="optional" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:simpleType name="validAttributeType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="java.lang.String" />
      <xs:enumeration value="java.lang.Integer" />
      <xs:enumeration value="oracle.jbo.domain.Date" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
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.