XML data binding libraries (or ability to call Java)?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
garynunes
Posts: 8
Joined: Tue Oct 31, 2006 6:59 pm

XML data binding libraries (or ability to call Java)?

Post by garynunes » Thu Aug 16, 2012 5:40 pm

Not sure if this is the correct forum for this query ... if not, my apologies.

Whatever one may think of Java it has a lot of infrastructure (e.g., libraries and tools) associated with it.
One support library/tool set that I've found especially useful is Java XML data binding libraries (e.g., I use Oracle's [previously Sun's] JAXB library).

For those unfamiliar with the concept, an XML data binding library allows one to write an XML specification, usually in W3C XML Schema (sometimes in DTD as well). One then passes the schema through a data binding tool and out comes code capable of reading/writing XML based on the schema. In the case Java XML data binding libraries, in goes the schema, out comes Java classes that read/write the schema's XML.

XML data binding libraries almost make it "fun" to use XML.

My two part question:
  • Does an XML data binding library exist for LiveCode (i.e., in goes the schema, out comes the LiveCode)?
  • If not, is it possible to call out to Java classes/libraries from with LiveCode (i.e., could I generate the XML reading Java classes and then use them within LiveCode)?
Thanks for any information you can provide.

Regards,
  • Gary Nunes

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: XML data binding libraries (or ability to call Java)?

Post by mwieder » Thu Aug 16, 2012 6:03 pm

The XML routines in LiveCode come from an external library which is a wrapper around an existing open-source library. The revCreateXMLTree and revCreateXMLTreeFromFile functions will serialize an xml stream into an xml tree object and there are multiple functions in the library to manipulate/extract data from the tree in various ways.

You can validate the tree against a DTD document., but you can't generate code based on the DTD or an xml schema unless you write the functions to do this yourself. This is what I did for my libSOAP library on revOnline - if you look at the wsdl functions there you will find routines to generate client and server functions from a wsdl document.

garynunes
Posts: 8
Joined: Tue Oct 31, 2006 6:59 pm

Re: XML data binding libraries (or ability to call Java)?

Post by garynunes » Fri Aug 17, 2012 2:10 am

Mark,

Thanks for your reply.

I've used routines similar to the ones you describe in LiveCode (from VB libraries for VBA macros that I've written) and, as my father used to say: "it's better than a kick in the head".

Still, one does get spoiled by the good things in life.

Regards,
  • Gary Nunes

Post Reply

Return to “Talking LiveCode”