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

<key> and <keyref> - predefined values for XML elements

  • To: xml-dev@l...
  • Subject: <key> and <keyref> - predefined values for XML elements
  • From: "Markus Seibold" <Markus.Seibold@g...>
  • Date: Wed, 11 Feb 2004 13:20:44 +0100 (MET)

xml keyref
Hello XML-DEV mailing list,

I am developing a XML Schema which should function as the interface to a
relational database. I first developed a ERM data model and am trying to derive
the XML Schema from this ERM model right now.

I came across the following problem:
I want to insert, for example, a country in the database. Therefore, I
declared an element <Country> in my main XML Schema. The country, among others,
has a subelement <language> which represents the official language(s) of the
country.

How can I assure that the value(s) of language in an instance document can
only be of specific predefined values?

I already tried the following: I created another XML Schema which is
included in my main Schema. The element <language> in the main schema is of
type="LanguageID":
<Another schema>
<simpleType name="LanguageID">
<restriction base="string">
<enumeration value="DE"/>
<enumeration value="EN"/>
<enumeration value="FR"/>
<enumeration value="SP"/>
</restriction>
</simpleType>
</Another schema>

But here comes my problem: There is a table in the relational database which
stores both LanguageID and LanguageName (i.e., EN and English). The Country
table is related with a m:n relationship to the Language table.

What I actually want to achieve in my XML Schema is to model this
relationship:
Whenever I insert a country via an XML instance document I want to spedify
the language(s) of this country by representing the foreign key relationship
between the two database tables.

What is the best approach for representing relationships to master data
(such as languages, currency codes etc.) in XML? 

I though about using <key> and <keyref>. <keyref> can only point to XML
element/attribute content in instance documents, right? So what I had to do is
represent the Language database table as an own XML instance document, right?

But how can I reference from instance documents based on my main XML Schema
(which contain the <country> element) to another XML instance file (which
contain the languages master data)? I read that XPath is not capable of this?

Sorry for this massive email but I really have no experience with
representing ERMs in XML Schema and need some help.

Thanks a lot!

Markus


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.