[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
> -----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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|