Translating from schema to classes
Schaefer, Don
Don.Schaefer at usa.xerox.com
Fri Jul 31 22:15:30 BST 1998
Good topic....
Is this an instance of the chicken and the egg? Meaning I use Rational Rose
to to my modelling. It generates code for all sorts of languages and it all
stems from UML. Should/could/can rose render a schema would be my question.
Whichever direction you choose its an important discussion...
As it is now I could work from three different fronts:
XML
IDL
UML....
These are all different avenues with a great amount of cross over. Rose
already generates idl. An idl compiler generates my language interface.
Maybe I should work from the idl.....
I hope that this reply is not tooo far out of context for this list.
don.
Don Schaefer
Questra Consulting
Rochester NY, 14625
dschaefer at questra.com
----------
From: Dean Roddey[SMTP:roddey at us.ibm.com]
Reply To: Dean Roddey
Sent: Friday, July 31, 1998 1:39 PM
To: xml-dev at ic.ac.uk
Subject: Translating from schema to classes
"I'm looking for a way of representing C/C++ data types in XML.
I've been searching around on the web and found references
to some existing XML that does this, but I haven't found the
document itself. Can someone give me a hand with this?"
This is related to something I was thinking about the other day. If I'm
going
to write some code to manipulate very 'record oriented' XML data, I'd often
end
up having a class that represents the records, into which I load the data
after
parsing it in. One thing that would greatly ease the job of doing this would
be
a program that would take an XML schema, a translation file, and spit out a
class that represents the schema (with getters/setters/serialization/etc...
appropriate for the language and library.) It could also automatically spit
out
a method that would (given a DOM fragment of that record type), suck out the
data for that XML record into itself (and vice versa to update the DOM
fragment
to represent itself again.
The translation obviously could also be an XML file in which a set of tags
are
defined that allow the translation to be customized, for instance a type
mapping tag that says any type foo:int should map to tCIDLib::TInt4 or
something like that.
So, when the XML changes, I can just rerun the translator and spit out the
new
class. Any added value I would just provide in a derived class, so that the
underlying data management class can be spit out as required, without losing
any of my code. You could do a translation file for Java, for C++ STL, I
could
do one for my CIDLib libraries, etc...
Is anyone doing something like this? Or is this just another dumb idea
(something I'm good at :-) It almost enough trouble to do a translation file
that it wouldn't be worth it unless you had a lot of different XML data
records
and/or a lot of different languages to spit out representations for. But the
ability to spit out a method automatically to pull out the data into/outof
the
record would be nice in many cases.
Just a thought anyway...
----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
roddey at us.ibm.com
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list