By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,963 Members | 1,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,963 IT Pros & Developers. It's quick & easy.

Help! XML Mapping to Relational Database Tables

P: n/a

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,

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
Anyway, I'm confused...thanks for any help!

Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.