470,814 Members | 763 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,814 developers. It's quick & easy.

Data binding to Python Java C[++,#]?

For a couple of years I am using now my own data binding tool that can
create C++ classes from a DTD. At this moment I need to reconsider
this tool since I want to use W3C XML Schemas and need to output to
more languages: C, C++, C#, python and Java. In reviewing existing
tools I came the following preliminary conclusions on which I like
your comments:

- there is no single open source tools capable of supporting all the
mentioned languages on both Windows and linux.
- existing tools generate too complex object models in the target
language for type of documents I am processing (see below).

The type of documents I need to process have schema's designed by
myself and only the elements and attributes are significant. Others
things such as processing instructions are ignored, except of course
the relevant info in the Document Type Declaration. The type of
schema's I am designing do have a number of restrictions that makes
mapping to an object model easy:
1) mixed content elements are not allowed
2) sibling elements can only have the same name if they are direct
3) if an element has an attribute named X it can not have an child
element named X.

The restrictions do make for easy name selection in the target object
model. For example:

<El Attr="1.34">

to C++:

class El {
double d_Attr;
Child1 d_Child1;
std::vector<Child2> d_Child2;

Note that the actual implementation has a more complicated definition
of the child types to get control over it contents. E.g. even a simple
double like Attr is actually wrapped in some sort of set/get mechanism
that can validate, serialize and deserialize the value.

The tool should generate an easy to use object model in the target
language with as little knowledge required by the client programmer
besides the structure of the object model itself. In other words,
minimizing knowledge on XML issues, DOM tree processing, etc. The
generated code should catch validation errors as soon as possible:
some already at a possible compilation, others at executing phase. I
do assume for each target language and operating system a DOM Api and
xsd validator to be present and callable from the generated language.

Performance is not an issue, the documents are assumed to be small.
All processing in my current tool is done using DOM with excessive
copying and cloning around to keep things small from a tool
development perspective.

I am aware of existing tools for Java (Castor) and Python (Amara) and
commercial tools supporting C++ and C# (MS SDK). But I am considering
to create such a tool that can target all languages myself, maybe by
wrapping existing tools, and release it as an open source project. Of
course the first questions then are:

- Is there are already something familiar out there I can join?
- Is there a commercial tool I must consider for efficiency/time
- Has anyone experience in targeting multiple languages, by using
probably multiple tools?
- If not, who is interested in such a tool? Or are my requirements too
- What other newsgroups, mailing lists, SIG's are a suitable platform
to discuss my questions and ideas?

I stop here with describing my existing and wished tool, although I do
have already a lot of specifications and things on my wish list where
such a Data binding generation tool should go to. For example, the no
"mixed contents allowed" restriction can be dropped, by including
generic XML trees that are can be kept and set, but need straight DOM
or SAX processing with little help from the generated object model.

Thanks for your time.

Cees Wesseling
Jul 20 '05 #1
0 1425

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Przemyslaw Wegrzyn | last post: by
4 posts views Thread by Neil Zanella | last post: by
16 posts views Thread by gaudetteje | last post: by
4 posts views Thread by Greg Linwood | last post: by
6 posts views Thread by Tim Roberts | last post: by
29 posts views Thread by dyork | last post: by
1 post views Thread by db2group88 | last post: by
18 posts views Thread by Jens | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.