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’

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.