473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

XSD Constraints

Hello,

I'm writing a schema, and I want to apply some contraints to the
combination of values that can be supplied for the attributes for one
of the elements. The problem concerns the Operation element in the xml
fragment below. The element has two attrbiutes, and I want to apply
some rules that ensure that the values provided are in agreement with
one another. For example, I want ensure the CREATE, UPDATE and DELETE
values for the Operation attribute are provided with a Sequence
number, but that the CREATEUPDATE value of Operation attribute is not
have a Sequence Number provided.

I want to <b>allow</bonly the following combinations:
<ns1:Operation Operation='CREATE' Sequence=(any +ve int)/>
<ns1:Data>Data</ns1:Data>
....
<ns1:Operation Operation="UDPATE' Sequence=(any +ve int)/>
<ns1:Data>Data</ns1:Data>
....
<ns1:Operation Oprtation='DELETE' Sequence=(any +ve int)/>
<ns1:Data>Data</ns1:Data>
....
<ns1:Operation Operation='CREATEUPDATE'/>
<ns1:Data>Data</ns1:Data>

but <b>prevent<b/the following xml
<ns1:Operation Operation='CREATEUPDATE' Sequence=(any +ve int)/>
<ns1:Data>Data</ns1:Data>
Does anyone know how this is achieved?
--Fragment--
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://www.world.com" xmlns:xs="http://www.w3.org/
2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:ns1="http://world.com/schema.xsd" targetNamespace="http://
world.com/schema.xsd" elementFormDefault="qualified" version="1.5">
<xs:element name="ScriptMark" type="ns1:MarkType"/>
<xs:complexType name="MarkType">
<xs:sequence>
<xs:element name="Operation" type="ns1:OperationType"/>
<xs:element name="Data" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="OperationType">
<xs:attribute name="Operation" type="ns1:OpType" use="required"/>
<xs:attribute name="Sequence" type="ns1:SequenceType" use="optional"/
>
</xs:complexType>
<xs:simpleType name="OpType">
<xs:restriction base="xs:string">
<xs:enumeration value="CREATEUPDATE"/>
<xs:enumeration value="CREATE"/>
<xs:enumeration value="UPDATE"/>
<xs:enumeration value="DELETE"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SequenceType">
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
Feb 1 '08 #1
0 1581

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul | last post by:
Hi: I am not sure whether somebody can sort it out for me. I am doing data transfer from one oracle database to another. Both of them has the same structure (like same tables etc).the only...
0
by: Rajesh Kapur | last post by:
We use InnoDB tables and foreign key constraints extensively. The mysqldump backs up the database tables in alphabetical order with foreign key constraints defined in the create statement of each...
1
by: Robin Tucker | last post by:
I'm considering adding domain integrity checks to some of my database table items. How does adding such constraints affect SQL Server performance? For example, I have a simple constraint that...
4
by: Dmitri | last post by:
I just looked at a coworker's stored procedure and this person is dropping 4 Foreign key constraints and then re-adding them after processing the required logic (updating rows in the 4 tables in...
2
by: DW | last post by:
Greetings: I have to do a one-off forceful change of some data in a database. I need to disable some FK constraints, make the data change, and then re-enable the constraints. My process will...
10
by: serge | last post by:
I am doing a little research on Google about this topic and I ran into this thread: ...
3
by: Tim | last post by:
I have spent the last 2-3 hours trying to find a way to just list the constraints for a given table (this includes referential - foriegn keys, not just check constraints). I know how to create...
0
by: BobTheDatabaseBoy | last post by:
i've Googled some this morning, but to my surprise, i don't find any offering (for fee or open source), which would integrate with, say Jakarta Struts, to provide the UI edits from cataloged...
3
by: Marek Berkan | last post by:
Hi, I have a problem with deffering constraints with db2. It was explained five year ago at this same group...
4
by: Bobby Edward | last post by:
I have an xsd dataset. I created a simple query called GetDataByUserId. I can preview the data fine! I created a very simple BLL function that calls it and returns a datatable. When I run...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.