473,545 Members | 721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Relational data to XML - Are there any standards?

Hello,

I need to take a set of input tables and create an XML output file. The
format of the XML output must be user-definable and must be intuitive
enough for non-techies to use.

input table(s) + SomeSchemaDefin ition ==XML file

I have seen examples of XML file generation with fixed scope. For
example, if input table (called customer) is as follows:

Id Name
101 Clark Kent
102 Peter Parker
103 Bruce Banner

The output XML generated is:
<root>
<customer>
<Id>101</Id>
<Name>Clark Kent</Name>
</customer>
<customer>
....

However, the user never had a chance to control the output format. In
my case, the user must have the abilitlity to define which columns are
attributes and which columns are child elements.

I am wondering if there is a standard that is already in place that I
must look at. Any other pointer is appreciated as well. Especially, how
are multiple level nestings handled?

Thank you in advance for your help.

Pradeep

Sep 7 '06 #1
7 1643
hi,

Pradeep wrote:
Hello,

I need to take a set of input tables and create an XML output file. The
format of the XML output must be user-definable and must be intuitive
enough for non-techies to use.

input table(s) + SomeSchemaDefin ition ==XML file

I have seen examples of XML file generation with fixed scope. For
example, if input table (called customer) is as follows:

Id Name
101 Clark Kent
102 Peter Parker
103 Bruce Banner

The output XML generated is:
<root>
<customer>
<Id>101</Id>
<Name>Clark Kent</Name>
</customer>
<customer>
....

However, the user never had a chance to control the output format. In
my case, the user must have the abilitlity to define which columns are
attributes and which columns are child elements.

I am wondering if there is a standard that is already in place that I
must look at.
SQL to XML is not standardized ; many RDBMS vendors provide proprietary
mechanisms to map SQL to XML, which can be enough for simple XML
targets, but can't deal with more complex XML structures

Any other pointer is appreciated as well. Especially, how
are multiple level nestings handled?
have a look at RefleX

an example here :
http://reflex.gforge.inria.fr/tutorial.html#N801062

this tool can map any SQL select statement to the XML structure you
would expect : you can choose
-which items become elements, attributes, or text,
-what are the names of attributes and elements if the names of the
columns doesn't suit,
-insert some container elements here and there,
-etc

it can output DOM, SAX or write to a file

you can launch it either from the command line or within a web
application, or embed it in your application

enjoy !
>
Thank you in advance for your help.

Pradeep
--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
Sep 7 '06 #2
The most standards-oriented solution I can think of offhand would be to
export/extract the relational data to XML in a fairly straightforward
manner, and then run that through XSLT to get your user-defined
formatting layer.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 7 '06 #3

Stefan Ram wrote:
I would consider to use a document per table, an ID-attribute
for the primary key and IDREF-attributes for foreign keys.
Why would you want to model the tables so exactly in the XML document ?
Aspects like keys are quite specific to a specific implementation
through an RDBMS and it's not necessarily important to preserve them.

Assuming that we're talking about some "applicatio n" purpose here,
rather than simply replicating an entire database, then the likelihood
is that we care less about "tables" and more about an
application-centred denormalised view across multiple tables. This view
doesn't require foreign keys (it's now a single view) and XML's
hierarchical nature can represent it easily.

I believe the common opinion that XML favors hierarchical data
to be wrong.
ID & IDREF suck. Therefore XML _favours_ hierarchical data. It's not
hierarchical to the exclusion of all else, but it's a strong
favouritism.

It might also be used for relation data quite
easily, as shown above, and since relations can model any
other kind of structure so can XML.
Tapeworms are Turning complete, therefore I can compute anything with
them.
But it's hardly practical, is it ?

Sep 7 '06 #4
Andy Dingley wrote:
ID & IDREF suck. Therefore XML _favours_ hierarchical data.
There's a lot more than ID/IDREF available once you move to schemas. Not
to mention the option of simply using XPaths in your own document syntax.

XML's native syntax is certainly tree-structured. But what you read that
into for manipulation is up to the application. DOM and SAX and such are
conveniences/tools, *NOT* universal solutions for all tasks.

(Of course IBM's now added XML support to DB2, recognizing that
sometimes a dataset is best manipulated hierarchically as an XML
infoset. Tools for tasks.)

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 7 '06 #5
Joseph Kesselman wrote:
Andy Dingley wrote:
>ID & IDREF suck. Therefore XML _favours_ hierarchical data.
Don't forget that XML was designed for normal text documents,
where ID/IDREF is a useful and robust mechanism. It is not
related in any way to whether or not XML favours hierarchical
data.

If you use XML for rectangular data, you have to understand that
you are pushing the limits of what XML was designed for.
There's a lot more than ID/IDREF available once you move to schemas.
Possibly. But that's a penalty you have to pay.

///Peter
Sep 7 '06 #6
Stefan Ram wrote:
"Andy Dingley" <di*****@codesm iths.comwrites:
Aspects like keys are quite specific to a specific implementation
through an RDBMS and it's not necessarily important to preserve them.

Keys are inherent to the relational model of the /data/ -
they are not an implementation detail of a specific RDBMS.
The concept of "keys" is relevant to any current "relational "
implementation of the data.

However the _specific_ use of keys is specific to the implementation.
There's a question of how far you normalise your data when designing a
relational model for it. You don't have to normalise to the same form
each time, and you don't have to use identical key structures.

If we see this "XML output" of the database model as being application
centric, then we don't care about such design choices. No matter how
normalised the data was when it was stored internally, we want the same
denormalised view for the output. As different implementations may have
used a different data model (an Access implementation was probably
de-normalised compared to a SQL Server implementation) , this difference
is now irrelevant, inappropriate and possibly misleading. Our XML
representation shouldn't preserve these keys.
I only know about them from the XML-application "XHTML 1.1",
where the id-attribute has ID-type and "for" and "usemap" have
IDREF-type, and was not aware of problems with this approach.
Read the RDF documentation. Much of RDF's work was in overcoming the
shortcomings of XML, in providing a usable data model for ID &
IDREF-like concepts.

XML has two major shortcomings here:

* To use IDREF, you must first have an ID. What happens if you want to
refer to a node that's identifiable, but not explicitly labelled ? It's
a valid requirement.

* ID & IDREF only work within a single document. To make small
appplications that can inter-work in a large universe, we need tools
that can refer outside their immediate frame of reference. XPointer is
an attempt here, but there's still a lot lacking with XML in this
context.

But it's hardly practical, is it ?

It's not so hard storing relational data in XML with one
element per set and one element per tuple, in fact, this
seems quite natural to me.
What's a "tuple" here ? A tuple as held in a table, or a tuple as a
row in a relational view ? I have no real interest in
tuples-from-tables, they're too low level and only really useful for
"database replication between databases with identical table structures
and data models".

If we look at the more interesing case of tuples from a view, then
these will be de-normalised (i.e. they have structure that would have
been normalised into multiple tables). An appropriate XML
representation of these is also normalised. Now we can still say "one
element per tuple" simply, but it has to become "one parent element for
one or more tuples" and "potentiall y more than one level of element
hierarchy within a tuple"

I strongly recommend studying MS SQL 2000 and the splendid hack with
which they implemented the "AS XML" select query, without changing
anything in the database itself. If you search the MSDN SDK for
"Universal table" then there's a good explanation of it. Basically any
"AS XML" query produces a huge denormalised scratch table called the
"Universal table", then a trivial row scanner runs through this and
generates new element hierarchies when column values change. Quite
useful, and a splendid low-effort hack.

Sep 8 '06 #7
Andy Dingley wrote:
* To use IDREF, you must first have an ID. What happens if you want to
refer to a node that's identifiable, but not explicitly labelled ? It's
a valid requirement.
Usual solution is XPath -- structural/content-based crossreferencin g
rather than pre-tagged -- and solutions derived from it such as
XPointer, or schema's keys, or the similar capabilities in XSLT and XQuery.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 8 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
7035
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. Yensao
18
2730
by: comcast | last post by:
Hello all, I am developing an interface system for an application I was written. This interface will connect to other system to share information. I would like to use xml and xsl to generically describe each interface. The trouble I am having is that it seem that if you export in xml by table then it is impossible to combine the xml...
0
2292
by: Stylus Studio | last post by:
DataDirect XQuery(TM) is the First Embeddable Component for XQuery That is Modeled after the XQuery API for Java(TM) (XQJ) BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies (http://www.datadirect.com), the software industry leader in standards-based components for connecting applications to data and an operating unit of Progress...
5
1576
by: Martin Marques | last post by:
Has someone read this: http://www.wiscorp.com/sql/Sql99_p2.zip Are this guys at Whitemarsh Information Systems Corporation important in the SQL99 writing? -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; ----------------------------------------------------------------- Martín Marqués | mmarques@unl.edu.ar...
49
3274
by: Mike MacSween | last post by:
I frequently hear that there isn't a commercially available dbms that fully implements the relational model. Why not? And which product comes closest. Mike MacSween
1
2180
by: Tim Fierro | last post by:
Hello, I have had many years using flat file databases (File Express from way back) but am now at a company where a relational database is needed and would carry us into the future. Since I know some basics on databases, have VB Pro programming experience over the years, and I know most of what we need to carry as far as data; I have...
6
1640
by: Shwetabh | last post by:
Hi, I have a very simple question. In what cases are relational databases necessary? Are they really necessary in cases where only a single type of query is to be performed based on one unique field or can we just put all fields together in a single database and just access them through that unique field?
1
3765
by: charles_gero | last post by:
Hi all, I had a question about the topics in the subject and posted to comp.std.c, but feel it may also be appropriate here. Please excuse this crosspost if it is in bad form. I have a question about whether or not I am interpreting a nuance of the standard correctly, and the implications of said nuance. The sections in the C99...
24
2072
by: sonos | last post by:
Hi, I am working on a program to archive data to disk. At what point is it best to use a relational database like MySQL as the backend instead of a C program alone? Thanks to any and all replies.
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.