Lists Home |
Date Index |
Thanks for your help. It's for an assignment I'm doing. The lecturer
states that I have to maintain referential integrity i.e. the Primary Key
and Foreign Key relationships must be maintained in the resultant XML file.
From: Ronald Bourret [mailto:email@example.com]
Sent: Tuesday, 22 March 2005 5:16 AM
To: Marco Mastrocinque
Subject: Re: [xml-dev] Creating a XML Schema for an existing database
XML Schemas can enforce referential integrity and the uniqueness of
primary keys using the Key/KeyRef and Unique elements only if all of the
data from the database is in a single XML document. The reason for this
is that Key/KeyRef and Unique cannot be used across documents -- a major
shortcoming in their design.
It is not clear why you would want to do this, as it would be very
inefficient for large amounts of data. (It would make more sense to
simply enforce integrity constraints in the database.)
What would be useful -- especially when used with native XML databases
-- is a way to specify integrity constraints across documents. Note that
any mechanism that did this should not restrict constraints to a single
schema. For example, I might want to say that (a) the value of the
Number element in documents matching the Part schema must be unique
across all such documents and (b) the value of the PartNum element in
documents matching the Invoice schema must match the value of a Number
element in a document matching the Part schema.
Marco Mastrocinque wrote:
> Hi All,
> Currently studying XML Technologies at postgraduate level. I know
> that you can use XML to replicate a database structure. I want to enforce
> Data Integrity i.e. Entity integrity, Domain integrity, Referential
> integrity and User-defined integrity. Can referential integrity be
> maintained using Unique Values by the 'Key and Key References,' technique?
> Please note I'm using the Apache Xerces validate tool. It does not seem to
> catch a deliberate error I placed in it. Please excuse me for my ignorance
> I'm still on my 'Learner Plates.'