Help! XML Mapping to Relational Database Tables

Mike (169)

Usenet Archive
Joined
Nov 21, 2003
Messages
3
Reaction score
0
Hello,

I'm trying to understand how to map hierarchical XML data to relational database tables, but I seem to be missing something. I'm not a database expert, but I know the basics. XML seems so much more intuitive to me, though.

Anyway, let me make up an example: Say we have an address book, in XML format, that is to be uploaded by a customer and then mapped into relational database tables. I would start by creating an XML Schema for the address book. Next, I would create database tables to store the data in. Alternatively, I know that there are tools that will help you create tables from an XML Schema, or create an XML Schema from existing tables. My first question relates to this - should the XML Schema that represents the address book data format that the user will upload be the same as the XML Schema that represents the database tables? I mean, the database tables will need to have a primary key, for example. Using a tool like XML Spy, I see that you can represent this in XML Schema using a "unique key" constraint. But it doesn't seem right that the user should be specifying key fields in their data? It almost seems that the XML Schema for the user data should be different from the XML Schema that represents the relational tables?

My confusion here started when I tried using XML Spy to create an XML Schema from a set of database tables, and then tried to apply that same schema to the data format sent by the user. It doesn't make sense to me that the user should have to specify the constraints?

Maybe...the address book format for the user data should be a 'fragment', and the server should insert root tags that specify something like:

<addressBooks> <--------Server Supplied <userID id="myUserID"> <--------Server Supplied <addressBook> <--------User Supplied <contact> <name>....</name> <blah>...</blah> </contact> </addressBook> </userID> </addressBooks>

Anyway, I'm confused...thanks for any help!

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top