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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: building an object model of a XML schema

Thanks Ron.  That makes sense.  I hope the 
vacation was very pleasant.  You haven't 
missed much here. ;-)

Today, I am looking in the other direction:  
given a relational database, create a schema 
for it (not the rowset thing, but using the 
table and field names).  It isn't that hard 
given use of refs and complexTypes, but there 
are some interesting wrinkles.   In this case, 
I am actually using a generator that was initially 
created to build table descriptions for documentation 
purposes (dumps out HTML tables).  I had used that 
to dump an XDR.  Now that MS published their 
stylesheet for converting XDR to XSD (which 
works and thank you, jmarsh@microsoft.com), I 
am taking that XDR output, converting, then going back in 
and tweaking things like enumerations.  This 
is all kludgy, but a way to get a first pass 
set of stuff to work with.  Once I have the 
schema, then there are options.  I know, this 
is using a snowplow to smooth concrete, but 
again, instructive.


Ekam sat.h, Vipraah bahudhaa vadanti.
Daamyata. Datta. Dayadhvam.h

-----Original Message-----
From: Ronald Bourret [mailto:rpbourret@rpbourret.com]

Sorry about the delay in answering. I've been on vacation.

"Bullard, Claude L (Len)" wrote:
> What if the idea is that the XML Schema is a set of reusable
> types, a toolkit that is then included/imported/redefined/substituted
> into other application languages?  I also haven't
> exported a schema out of UML, but it seems to me it
> may include classes that such a design would not use.

This makes sense to me, but is a restricted use of XML Schemas. That is,
you're likely to use XML Schemas very carefully, in a way that makes
sense to translate them to objects. This is also similar to the point
Jeff Lowery makes in one of his answers -- that you can use XML Schemas
for object modeling.

> This probably turns on what you said:  if one is
> designing objects, design objects.  OTOH, there
> is that intermediate step where one is not quite
> designing documents in the print document or online
> document sense, one is designing reusable data
> sets more like relational tables than objects
> (no explicit operations) and a little less like
> a document (no explicit assembly).

This is a case I noted in my comments -- that it makes sense to generate
object schemas from XML Schemas when the XML defines a common data
model, rather than a common object model. This happens in open systems,
such as when you're using ebXML.

However, I think this requires a big caveat -- that the generated
objects are probably only a starting place for the real objects. As I've
said somewhere (on this list or another), my experience from generating
database schemas from DTDs is that structures that make sense in XML
documents don't always make sense as structures in the database. The
same is undoubtedly true of objects. This is the point that Michael
Brennan and Dave Brownell make in their responses.

Note that I'm not sure if the various data binding products (e.g. JAXB,
Castor) give you enough control to use objects that are substantially
different from the XML. That is, they might rely on a strict mapping
with few choices. In such a case, it might be necessary to transform the
XML document before creating objects and after serializing them. A lot
of people who use my software to transfer data between XML and databases
do this.

By the way, I've added a reference to this discussion to the paper.

-- Ron

The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative
of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: xml-dev-request@lists.xml.org