[
Lists Home |
Date Index |
Thread Index
]
- From: Michael Rys <mrys@microsoft.com>
- To: 'Chuck White' <chuckwh@pacbell.net>, xml-dev@lists.xml.org
- Date: Wed, 27 Dec 2000 19:37:51 -0800
In principle you need to prefix integers. Since ID values in databases that
are used as primary keys are only guaranteed to be unique per table and not
per database, prefixing is a good idea in general, if the generated XML
document contains data from different tables.
For an example on how it can be done, look at the sql:id-prefix annotation
of the schema-driven XML view mechanism of SQLServer 2000.
Best regards
Michael
--
Program Manager, SQL Server XML Technologies
mrys@microsoft.com, rys@acm.org
We store the Web and more...
> -----Original Message-----
> From: Chuck White [mailto:chuckwh@pacbell.net]
> Sent: Wednesday, December 27, 2000 7:23 PM
> To: xml-dev@lists.xml.org
> Subject: ID and IDREF and databases
>
>
> Given that unique IDs in a database are integers, how does
> one map unique
> IDs from that database to an ID attribute value type? Is
> anybody mapping
> data using ID against database unique identifiers that have
> integer data
> types?
>
> The solution that comes to my mind that I haven't tried would
> be to generate
> rowsets (I'm specifically looking at Order Numbers) and use
> XSLT to generate
> ID attributes with letter prefixes from the generated Order
> elements so that
>
> <rowset>
> <Order_ID>30011</Order_ID>
> <IO_ID>11111</IO_ID>
> <rowset>
>
> becomes
>
> <rowset>
> <Order_ID io_id="o:11111">30011</Order_ID>
> <rowset>
>
> Maybe my question should be more general. Are there any best
> practices out
> there for mapping against databases using DTDs? Even if I use
> a schema, it
> seems like the QName constraints on ID makes its use
> prohibitive without
> jumping over the hurdle of transformation.
>
> I know the thing was probably designed with the DOM in mind,
> but ID also
> seems like a perfect candidate for managing primary and
> foreign key values,
> if not for this small problem. Maybe I'm missing something
> here, and it's
> worth a flame to find out if I am.
>
> thanks,
> Chuck White
> Author, Mastering XML Premium Edition, Sybex Books
> (February 2001)
> Internet Explorer 5 Developer's Guide, IDG Books
> http://www.javertising.com
>
|