OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: xml spec 1.0 validity constraint for ID/IDREF

[ Lists Home | Date Index | Thread Index ]
  • From: "Tolkin, Steve" <Steve.Tolkin@fmr.com>
  • To: Xml-Dev <xml-dev@xml.org>
  • Date: Wed, 29 Mar 2000 17:40:29 -0500

> -----Original Message-----
> From: Kevin Williams [mailto:Kevin.Williams@ultraprise.com]
> Sent: Wednesday, March 29, 2000 3:56 PM
> Subject: RE: xml spec 1.0 validity constraint for ID/IDREF
> prefix the (integer) key with the element name, 
...  e.g. 
> <Borrower 
>   BorrowerID="Borrower18273" 
> 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 ...

I presume it does, in your case, because you know that
no table name is a prefix of another table name.  
But in general simply concatenating the table name and
table key together is NOT guaranteed to produce a unique id.

A simple example: if you have table foo with key 22, and 
table foo2 with key 2, then you will get "foo22" from each.

For this technique to work reliably on any database
you must also use a separator character.
This character must be known never to occur
either in table names or in the table keys,
and must be legal in XML ids.  
The most likely such characters are the colon and hyphen.

In many cases the unique key of the database table is a 
compound key.
That requires also using the separator between the components.

Not using a separator is very dangerous because it can cause 
subtle bugs, difficult in part because they are data dependent.

Hopefully helpfully yours,
Steven Tolkin          steve.tolkin@fmr.com      617-563-0516 
Fidelity Investments   82 Devonshire St. R24D    Boston MA 02109
There is nothing so practical as a good theory.  Comments are by me, 
not Fidelity Investments, its subsidiaries or affiliates.

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/


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS