473,327 Members | 1,936 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,327 software developers and data experts.

A matter of style and referential integrity!

I've included below a fragment of an XML Schema (XSD). Note the
'localize' complexType used in three situations (twice in the 'site'
element, and once in the 'page' element). The specifications require
that there be unique @language text nodes within each 'localize'.
I was able to describe the constraint as shown, i.e., including key in
each localize type element. Is there an elegant way of specifying this
constraint just once without resorting to this repetitive text?

To my second question I have not found an answer. The 'site' element
is a root element, it has the @homepage attribute whose value should
be the unique @id of a 'page' element (note the homepageFK keyref.)
The XML validates correctly even if the homepage does not exist!
<xs:complexType name="localize">
<xs:sequence maxOccurs="unbounded">
<xs:element name="text">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="language" type="xs:language" use="required"
/>
<xs:attribute name="modified" type="xs:dateTime" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

<xs:element name="site">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="localize" minOccurs="0">
<xs:key name="siteDescriptionPK">
<xs:selector xpath="./text" />
<xs:field xpath="@language" />
</xs:key>
</xs:element>
<xs:element name="keywords" type="localize" minOccurs="0" >
<xs:key name="siteKeywordsPK">
<xs:selector xpath="./text" />
<xs:field xpath="@language" />
</xs:key>
</xs:element>
<xs:element ref="page" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="homepage" type="xs:NCName" use="required" />

<xs:key name="pagePK">
<xs:selector xpath=".//page" />
<xs:field xpath="@id" />
</xs:key>
<xs:keyref name="homepageFK" refer="pagePK">
<xs:selector xpath="." />
<xs:field xpath="@homepage" />
</xs:keyref>
</xs:complexType>

<xs:element name="page">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="localize" >
<xs:key name="pageTitlePK">
<xs:selector xpath="./text" />
<xs:field xpath="@language" />
</xs:key>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:NCName" use="required" />
</xs:complexType>
</xs:element>
<site homepage="myhomepage">
<description>
<text language="en">bla bla bla</text>
<text language="fr">blu blu blu</text>
<text language="it">bli bli bli</text>
</description>
<page id="home" />
<page id="photos" />
<page id="download" />
</site>
Jul 20 '05 #1
0 851

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

Similar topics

1
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into...
7
by: Jimmie H. Apsey | last post by:
Referential Integrity on one of our production tables seems to have been lost. I am running Postgres 7.1.3 embedded within Red Hat kernel-2.4.9-e.49. Within that I have a table with referential...
5
by: Geisler, Jim | last post by:
So, as far as I know, PostgreSQL does not have any way of verifying the loss of referential integrity. Are there any recommended methods or utilities for checking referential integrity in a...
6
by: heyvinay | last post by:
I have transaction table where the rows entered into the transaction can come a result of changes that take place if four different tables. So the situation is as follows: Transaction Table...
80
by: Andrew R | last post by:
Hi I'm creating a series of forms, each with with around 15-20 text boxes. The text boxes will show data from tables, but are unbound to make them more flexible. I want the form to be used...
3
by: moskie | last post by:
Is there a way to run an alter table statement that adds a constraint for a foreign key, but does *not* check the existing data for refrential integrity? I'm essentially looking for the equivalent...
6
by: CPAccess | last post by:
How do I maintain referential integrity between a main form and a subform, each based upon different (but joined with integrity enforced) table? Here's the situation: I have two tables:...
16
ADezii
by: ADezii | last post by:
Indent - A procedure normally has several sections. There may be a section for error-handling code, groups of code lines for repetitive operations, alternative groups of statements to be executed...
3
by: Wayne | last post by:
I've inadvertently placed this post in another similar newgroup, and I apologise if you get it twice. I'm building a database that consists of frontend and backend. Some of the lookup tables...
2
by: ApexData | last post by:
Access2000, using a continuous form. I’m getting a message that say “you cannot add or change a record because a related record is required in table Employee”. This occurs in all my combobox...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.