Updating an XML file which is available on the eXist database using C/C++

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating an XML file which is available on the eXist database using C/C++

Mustafa MISIR
Hi all,

I must write C or C++ code to update an XML database which is available on eXist Database and also I must do this via using XML-RPC.
I read some tutorials about it and reached some C and C++ libraries, but I could not find any solution to do this.
How I can handle this problem?


Yahoo! FareChase - Search multiple travel sites in one click.
Reply | Threaded
Open this post in threaded view
|

Re: Updating an XML file which is available on the eXist database using C/C++

Michael Beddow-2
> I must write C or C++ code to update an XML database which is
> available on eXist Database and also I must do this via using XML-RPC.

Maybe I just have a suspicious mind, but this looks to me as though we are
perhaps being invited to help with someone's class assignment. Or maybe with
meeting the demands of a manager who issues strict targets without providing
essential resources. As a former prof in the insanely-managed UK university
system, I have no sympathy with the first, but I feel deeply for the plight
of the second.

But anyway, there are four aspects  here. Most of them haven't anything to
do with eXist, so you'll need to look elsewhere for help, and the one that
does is already taken care of in the sample code supplied.

Issues:
1) Choice of C or C++
2) Locating a suitable XMLRPC library compatible with the development system
chosen
3) Understanding how to do XMLRPC
4) Dispatching and receiving queries to and from eXist over an XMLRPC
transport.

Solution pointers:
1) If you are at all fluent in C++, choose that. A well written class
library will save you a whole lot of coding grind that you will need to do
yourself if you opt for C.
2) Google. Look for user comments/experiences as well as developer claims
for the various libraries.
3) Any decent library will have some sample code, including a barebones
XMLRPC server and similarly barebones client. Implement both on your
development machine, and learn how to get them to talk to each other.
4) Then the easy part. Consult the eXist developer docs, look at the sample
code, a great deal of which uses XMLRPC to talk to the backend, and emulate
what you see in your own client code. Another reason for choosing C++ rather
than C at step 1). With due caution, Java to C++ "translation" is much
easier than Java to C.

One warning re 4). The original developers and earliest implementers of
XMLRPC were mainly the sort of folk who think Unicode is for peculiar
foreigners who want to do suspicious things. As a result, in its more
primitive versions, XMLRPC assumes that QNames and PCDATA will all be in
ASCII and that anything else must be treated as binary and BASE64 encoded,
even if it is actually textual data in an encoding which the XML spec
requires all conformant processors to support. So, depending on your choice
of library, and on the data and the writing systems you need to handle, you
may just find that you need to encode text as if it were binary to get it
uncorrupted across the transport. On the eXist side, the utf-8 handling is
clean (though of course you must still BASE64 encode any data that really
*is* binary), PROVIDED you make sure you are using the XMLRPC jar that ships
with eXist itself, and *not* the one that may have come with a separate
disribution of Cocoon or Jetty or whatever.

Michael Beddow




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open