Jump to content
Sign in to follow this  
stribor40

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...