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

Re: database primary keys in XML Schema


primary key in xsd
Regarding #1: Not sure why one would want to insert a primary key value
into an XML document that is different than the value coming from their
database (i.e. should be database-to-XML-document), but I'll respond in
a more general sense.

I would recommend you look at the xsd:key and xsd:keref elements in the
W3C Schema Primer [1]. Hope it helps.

Kind Regards,
Joe Chiusano
Booz | Allen | Hamilton
Strategy and Technology Consultants to the World

[1] http://www.w3.org/TR/2001/REC-xmlschema-0-20010502/

Markus Seibold wrote:
> 
> Hello everybody,
> 
> I am developing a XML Schema which should function as an interface to a
> relational database.
> I have problems with how to design the primary keys in XML Schema.
> 
> 1.) When I insert data via XML instance documents the first time, I cannot
> specify a primary key in my XML instance document because the database
> automatically creates an auto-increment key. Correct?
> 
> 2.) What if I, for example, want to insert a city in a geography database
> (the database has a Country and a City table; 1:n relationship). When inserting
> a city, how can I specify to which country the city belongs? I needed to
> know the database primary key for the country, wouldn't I and add this key as an
> attribute to the city in my instance document?
> What other solutions do exist?
> 
> This issue cost me alot of time so far and I would really appreciate any
> help!
> 
> Thanks a lot, Markus
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>

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.