[
Lists Home |
Date Index |
Thread Index
]
- From: Kevin Williams <Kevin.Williams@ultraprise.com>
- To: Xml-Dev <xml-dev@xml.org>
- Date: Wed, 29 Mar 2000 15:55:41 -0500
> -----Original Message-----
> From: Peter Murray-Rust [mailto:peter@ursus.demon.co.uk]
> Sent: Wednesday, March 29, 2000 8:30 AM
> To: gopi; Xml-Dev
> Subject: Re: xml spec 1.0 validity constraint for ID/IDREF
>
> My suggestion - FWIW is that you use a separate attribute or
> PCDATA for
> your foreign key, and write your "application" to take care
> of uniqueness.
> It is a good example of the fact that XML is not a magic bullet which
> solves all your problems. But it does help to identify them
> and XML-DEV
> helps to encourage people to solve them.
One approach that I have taken for some of the systems I have designed is to
prefix the (integer) key with the element name, or some portion thereof. For
example, we might have:
<Borrower
BorrowerID="Borrower18273"
FirstName="Kevin"
LastName="Williams"/>
for a borrower in our Borrower table with the key 18273.
Since our data is coming from a relational database, prefixing the key with
the element (table) name guarantees uniqueness across all documents that can
be created from the RDB. The bonus is that if the receiving system is using
the same key structure (as it is in our case), the key may be used as
provided (after ripping off that pesky prefix). We needed some sort of
prefix anyway, since we might have a Borrower 18273 and an Asset 18273, so
this change didn't bother us too much. I have to admit, though, I initially
had the same annoyed reaction when I discovered I couldn't just use my keys
directly...
- Kevin
***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************
|