Jump to content

specifying restrictions on dynamic data


Guest ervikas

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

Link to comment
Share on other sites

  • 5 months later...

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.

Link to comment
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
×
×
  • Create New...