Wednesday, March 9, 2011

Importing a LiveCycle ES process into LiveCycle ES2

Back in july I had a blog posting about moving LiveCycle ES 8.2 processes to an ES2 environment, found here. Since then, Adobe has put up a new tool in their Labs that that will install as a plugin to Workbench. With this archive migration tool installed, LiveCycle Workbench ES2(SP1) users can import a LiveCycle 8.x archive into the Workbench workspace directly to take advantage of the new features available in ES2. A new LiveCycle ES2 application is created and all the resources in the 8.x archive are imported into the ES2 application.
The new tool can be found at http://labs.adobe.com/technologies/lcworkbench_archivemigration/

Inferring an XSD from XML

When working with forms in LiveCycle, it is important to know the structure of the XML data that gets exported from the form and passed around the LiveCycle process. In ES2 Adobe has introduced the ability to create and use an Adobe Data Model to describe the structure. Workbench has a tool which will allow you to to create these models and Adobe is really trying to encourage developers to use it more, not just in LiveCycle development, but also in enterprise level development with Flex and Java.
However, being old school, I still found it more comfortable to use an XML schema file (.xsd) to describe the structure of the data in the form and to use in a LiveCycle process to be able to access the separate fields in a form.
Creating an XSD can be troublesome, creating it from scratch even more so. The easiest method to create the XSD file is by inferring it from an XML file. There are many XML editors that are able to do this, a few being:
Unfortunately you have to pay for these software. There are a few free options out there, my favorite being Trang. Its a small and simple command line tool that works in multiple platforms. The way to use it is to
  1. Download Trang. You can download Trang at http://www.thaiopensource.com/relaxng/trang.html
  2. Extract the files from the zipped download
  3. Run the command passing your input XML file (it can be multiple XML files) and specifying the result XSD file.
The syntax of the command should look like;
java -jar trang.jar input.xml input2.xml input3.xml output.xsd
And its as simple as that! You have your XSD file that you can use in your form and in your process to describe the structure of the data.