Jump to content
Sign in to follow this  
Guest ervikas

specifying restrictions on dynamic data

Recommended Posts

Guest ervikas

Hi allI am trying to create xsd schema that can model a database schema. In my DB schema i am using the primary key foreign key relationship to make sure that when a row is inserted in a particular table, the value in one of it's columns should be a subset of values(that can grow dynamically) that are defined in a column in other table.Now i want to model this in xsd schema. I learnt that by using xsd:restriction we can restrict that values of an element to a static set of values declared in the schema, but my problem is that i cant predefined the set of values as i cant predist the values beforehand. How can i model this kind of relationship in xsd.Thanks in advance

Share this post


Link to post
Share on other sites

By using a pattern. The pattern itself is a regular expression. For example:

<xs:simpleType>  <xs:restriction base="xs:string">	<xs:pattern value="[a-z]"/>  </xs:restriction></xs:simpleType>

means that the node using this type could only have a string that contains only lower case latin letters. You can also use the built in schema data types. For example:

<xs:element name="age" type="xs:integer"/>

means the element "age" can only contain integers.If you could tell any sort of pattern your data matches to, there's always a way to match it against some regular expression.

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...