OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



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

[ Lists Home | Date Index | Thread Index ]

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

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
<Another schema>
<simpleType name="LanguageID">
<restriction base="string">
<enumeration value="DE"/>
<enumeration value="EN"/>
<enumeration value="FR"/>
<enumeration value="SP"/>
</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
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!



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS