Jump to content
Sign in to follow this  

xml schema for element with attribute and text content

Recommended Posts

I am trying to create xml schema for this element...

<shoesize country="yes">35</shoesize>

based on w3 schools this is solution....

<?xml version="1.0" encoding="utf-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="shoesize">  <xs:complexType>    <xs:simpleContent>      <xs:extension base="xs:integer">        <xs:attribute name="country" type="xs:string"  />      </xs:extension>    </xs:simpleContent>  </xs:complexType></xs:element></xs:schema>

what I am trying to restrict is that attribute can only be "yes" or "no" and content can only be integer less than 50. Can anyone give me some pointers how to do this please.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this