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

XML-Data and database mapping

  • From: Andy Dent <dent@o...>
  • To: xml-dev@i...
  • Date: Thu, 6 May 1999 17:03:27 +0800

database mapping
I've been wrestling with issues for encoding databases (and report
definitions) into a single XML file and restoring them, for some time. I
would appreciate some feedback on the following. I would be ecstatic to be
told I'm blind, stupid, lazy and have missed some very obvious postings
covering all these issues :-)


My current compromise is to have
   other tags

where the schema describes all following tags but obviously not the root
<report> tag.

Note: I'm using the MS convention of <Schema> rather than strict XML-Data
name <schema>.


The most serious problem I see with mapping database schemae using XML-Data
or the other published suggestions is the lack of scoping.

As I understand the (suggested) specifications and the current MS versions,
fields within database tables will be handled by <ElementType> definitions
and referred to from within a table's <ElementType> by <element> tags.

This means that fields within tables are globally scoped in their
definition, unlike the usual DB practice that a field is defined within the
context of a database table (relation).

At a trivial level, "Name" might be a compatible data type such as
fixed-length string, but a different length, within <Person> and

I would vastly prefer to use an agreed standard for our schema
export/import but this restriction makes it impossible.

Once you accept that field definitions can be scoped within tables, it's a
much nicer syntax to define field data types within the <element> tag as
shown below. This approach can co-exist with defining <ElementTypes>
separately as separate definitions would be seen as
   <element id="#Address">
instead of
   <element name="Addresss" dt:dt="string">


FWIW the following is the current output of our report writer, which I am
in the process of enhancing so it can read such a report document back in

1) we encode layout separately from style

2) the style strings are mainly CSS compliant except if we have things like
graphs where we use CSS-like syntax to describe graph attributes

3) our layout has a CSS object model where possible and includes an
assumption of nested styles - an element within the layout inherits styles
from its containing elements.

<?xml version="1.0" standalone="yes"?>
     OOFILE extension to XML-Data allows <element> definition without
<ElementType> for primitives
     so our dbFields are <elements> with the datatype declared as
attribute, rather than the
     official method of declaring an <ElementType> then using an IDRef in
the type attribute
      <ElementType name="perfTable">
         <element name="ID" dt:dt="string" oof:maxlen="15"/>
         <element name="Name" dt:dt="string" oof:maxlen="41"/>
         <element name="Awarded" dt:dt="ui4"/>
         <element name="Teacher" dt:dt="string" oof:maxlen="8"/>
   <layout ID="1-1">
         <box ID="1-1-1">
            <inline>Page 1</inline>
         <box ID="1-1-1-2">
            <inline>Set your school name in &apos;Preferences&apos;</inline>
         <box ID="1-1-1-3">
            <inline>Outcomes achieved by this student</inline>
            <inline>Josef ABRAMSON</inline>
         <space height="4"/>
         <HR height="2"/>
         <space height="12"/>
         <HR height="2"/>
         <space height="4"/>
         <box ID="1-1-1-3">
            <inline>KIDMAP 99 for Macintosh</inline>
            <inline>Printed by KIDMAP Manager on 5/5/1999</inline>
      <table ID="1-1-1" source="perfTable">
            <space height="12"/>
            <box ID="1-1-1-1-2">
               <inline>Number of outcomes listed: </inline>
        #1-1-1{font-family: Helvetica; line-height: 1.000 ; font-size:  10
; color: rgb(0, 0, 0); text-align:  left}
        #1-1-1-2{font-family: Helvetica; line-height: 1.000 ; font-size:
16 ; font-weight: bold; font-stretch: expanded; color: rgb(0, 0, 0);
text-align:  left}
        #1-1-1-3{font-family: Helvetica; line-height: 1.000 ; font-size:
14 ; font-weight: bold; color: rgb(0, 0, 0); text-align:  left}
        #1-1-1-3{font-family: Helvetica; line-height: 1.000 ; font-size:
10 ; font-weight: bold; color: rgb(0, 0, 0); text-align:  left}
        #1-1-1{font-family: Helvetica; line-height: 1.000 ; font-size:  10
; color: rgb(0, 0, 0); text-align:  left}
        #1-1-1-1-2{font-family: Helvetica; line-height: 1.000 ; font-size:
12 ; font-weight: bold; color: rgb(0, 0, 0); text-align:  left}
         <Name>Draws upon play</Name>
         <Awarded>16th Mar 1999</Awarded>
         <Name>Use experience</Name>
         <Awarded>16th Mar 1999</Awarded>
         <Name>Explore ideas</Name>
         <Awarded>16th Mar 1999</Awarded>
         <Name>Experiment - ideas</Name>
         <Awarded>16th Mar 1999</Awarded>

Andy Dent BSc MACS AACM, Software Designer, A.D. Software, Western Australia
OOFILE - Database, Reports, Graphs, GUI for c++ on Mac, Unix & Windows
PP2MFC - PowerPlant->MFC portability

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


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.
First Name
Last Name
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.