Lists Home |
Date Index |
On Friday 08 November 2002 22:30, Bing-huang Cheng wrote:
> I'm new to XML and my current work is to provide a data connection in XML
> between 2 machines through network.
> I'm interested to know how generally people do this kind of jobs from the
> program's point of view. Do people wrie program to compose protocol
> messages in XML (probably DTD as well), send to the other end, and then the
> receiver uses an XML parser to get a DOM structure from the message, and
> access the message data through the DOM structure?
> This is kind of big overhead and people who want to use XML as their
> message encapsulation need to understand XML first.
> I'm thinking a way that the application/protocol programmers do not have to
> worry about the XML format and still send/receive messages in XML. That is,
> 1. Before the compile time, the C header file defining the message formats
> is translated to an XML schema file by a certain tool (e.g. TOOL-1) off
> 2. A utility library (e.g TOOL-2) is used during run time to generate an
> XML text stream based on two inputs: "a C struct object for a message
> format" and "the XML schema file generated in step 1".
> 3. The receiver can get the same C struct object that a sender sent by
> calling a tool like XML parser (e.g. TOOL-3) with two inputs: "the XML text
> stream received" and "the XML schema file generated in step 1".
> Is this doable? Are these tools (TOOL-1, TOOL-2, and TOOL-3) available from
> the Internet? Or how do people generally do about this?
If I understand you correctly, I think you will find that tools 1-3 can be
found in JAXB . Basically what you do is define a DTD for your message
first, then define a binding between the DTD and a (Java) data structure.
JAXB then generates the Java classes for this data structure which you can
then compile into your app. At the receiving end, the programmers could
either use your classes or create their own binding (allowing them to use
their own class naming conventions or other local options).
 Goes into a lot more detail about the principles of data binding as well
as providing a comprehensive list of resources (you will probably find some
C/C++ data-binding tools their, if that is your chosen development language).
Google for "XML Data Binding" for more!
Kal Ahmed, techquila.com
XML and Topic Map Consultancy
p: +44 7968 529531