[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: XML as an interface
- From: Danny Ayers <danny@panlanka.net>
- To: xml-dev@lists.xml.org
- Date: Wed, 14 Feb 2001 20:55:38 +0600
Hi,
Am I right in thinking you have Java at each end of the interface? (the
mention of a client JVM suggest this) If so then your problem shouldn't be
too difficult to solve.
Many app servers already have facilities for streaming out XML, e.g. as a
TextMessage - if there's nothing immediately available for WebLogic then
it's not too tricky to build what you need. Two main alternatives spring to
mind for creating the XML to pump out - either do it serially or as a DOM
document. If you are dealing with very large documents (i.e. ones that take
data from a lot of records) then the serial approach is probably best as you
don't need a big in-memory model. Obviously it will depend on the data you
wish to transfer, but this can be done using anything from fairly
hard-coding "<field attribute="+value+">stuff</field", up to creating the
text much more dynamically. With DOM it's pretty straightforward, you create
a document and create elements as child nodes in that, and then serialize
the whole thing out.
I think another approach would be to use XSLT, but as you have Java in place
it's probably more straightforward to use that directly.
On the receiving end, then you can either reconstruct the DOM tree or
extract the data using a SAX parser. This is very straightforward in Java.
To get this into the C++ you'll probably be looking at JNI.
If you can't use Java at the client end, or if it seems better not to, then
you'll need to look at a C++ parser - if you've got Windows clients then
there's MSXML (see http://msdn.microsoft.com/xml/general/xmlparser.asp) This
has support for SAX and DOM.
Creating the objects in C++ could be tricky - again this will depend a lot
on the data, the more you know in advance about the fields of the objects
the easier this will be. Brendan Macmillan has done a lot of work on
bridging between XML and Java objects (see
http://sourceforge.net/projects/jsx/), perhaps you could talk him into
porting it to C++ - though don't tell him I said that!
There's plenty of material on the Java aspects of this type of thing at
http://www.java.sun.com
Good luck and good afternoon!
Cheers,
Danny.
PS. I see you work for Severn Trent - any sandbags left?
<- -----Original Message-----
<- From: stephen_lake@sts.co.uk [mailto:stephen_lake@sts.co.uk]
<- Sent: 13 February 2001 16:41
<- To: xml-dev@lists.xml.org
<- Subject: XML as an interface
<-
<-
<- Good Morning,
<-
<- I have a problem!
<-
<- I am working on a (legacy) product that needs to have an XML
<- interface. Let me give some background.
<-
<- The product is written in C++, and sits on a client machine. The
<- product launches a JVM. There is an application server (WebLogics),
<- and the data access is using EJB's. We are communicating
<- between the
<- server and the JVM using JMS. The messaging system will be carrying
<- the data as XML.
<-
<- My problem is the conversions:
<- 1, The (java) server needs to be able to create the XML
<- from the data.
<- 2, The (C++) client needs to be able to create objects
<- from the XML.
<-
<- Could someone point me in the correct direction for these two
<- processes.
<-
<- Regards
<-
<-
<- Stephen J Lake
<-
<-
<-
<-
<-
<-
<-
<-
<- ***********************************************************************
<- This message has been sent via the Internet. Internet communications
<- are not secure against interception or modification. Severn Trent
<- Systems therefore can not guarantee that this message has not been
<- modified in transit, and this message should not be viewed as
<- contractually binding.
<-
<- This message and any files transmitted with it are confidential and
<- intended solely for the use of the addressee. If you have received
<- this message in error please notify the sender and destroy your
<- copies of the message and any attached files.
<- ***********************************************************************
<- Severn Trent Systems Ltd : a part of Severn Trent plc.
<- Registered in England and Wales Registration No. 2394552
<-