Validate both element and attribute with XSD

I have this XML snippet that I need to validate:


  Volvo

I want to validate both the attribute ‘model’ content and the element content ‘Volvo’. Here is one way of doing it (thank you Alex):


:

  <xs:complexType>
    <xs:simpleContent>
      
        <xs:attribute name="model" type="xsd:string"/>
      
    </xs:simpleContent>
  </xs:complexType>

:

The base attribute will validate the element content ‘Volvo’ and the attribute type will validate the ‘model’

Comments are closed.