[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xml spec 1.0 validity constraint for ID/IDREF

  • From: "Tolkin, Steve" <Steve.Tolkin@f...>
  • To: Xml-Dev <xml-dev@x...>
  • Date: Wed, 29 Mar 2000 17:40:29 -0500

xml id constraint
> -----Original Message-----
> From: Kevin Williams [mailto:Kevin.Williams@u...]
> 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,
Steve
-- 
Steven Tolkin          steve.tolkin@f...      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@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.