Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Binding XML file Dynamically

Avatar

Former Community Member

Can I bind a xml file dynamically to a form? say, bind to a different xml file after user select a value from a drop down list in the form?

how to do it? Thanks.
10 Replies

Avatar

Former Community Member

LiveCycle uses the XML as a sourcefile for generating the content, it is provided before generation meaning I seriously doubt your goal is achievable, yet I'm no expert in LiveCycle myself...

Avatar

Former Community Member

Is the intention to re-populate the existing PDF form with a different XML instance?

Avatar

Former Community Member

thanks for the reply.

what i trying to do it is to implement a form with multi language.

so, when a user select a language from a drop down list then labels and captions bind to a correct xml file.

or please advise the best way to implement a form with multi language.

thanks.

Avatar

Former Community Member

I think it's best to create different XPD files for each language and add an XML tag <language>countryCode</language> to your XML dataset and XSD file. this way you could tell the workbench to use a different xpd file for generating the PDF file.

Anyway if you want to load an XML file from your local filesystem you should check out this URL: http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm it shows you how to read & write files using javascript.

The problem you'll be facing is editing the binding and reading + validating the given XML file. Especially validating the XML vs the XSD file used in the designer will probably cause a few errors, yet this is highly recommended in order to make sure you're not modifying your PDF with the wrong (or even malicious) data.

Security-wise i would not implement it your way but make a different XPD file for each language. In the LiveCycle Workbench you can select the correct XPD file based on the data you provide. Then it's just the user who needs to specify his/her language and your pdf is always build correctly. Yet I do not know if this is applicable to your situation and/or needs.

Avatar

Former Community Member

I have attached a PDF that display captions based upon data binding. The PDF has two buttons - French and English. Based upon the selection you can import either 'captionFrench.xml' or 'captionEnglish.xml'.

If the attachments get queued, and they probably will, please send an email to stwalker.adobe@gmail.com and request the attachments.

Steve

Avatar

Former Community Member

thanks MaFdOn, can you show me how to select a different xpd file from workbench?

is it possible to select the xpd file base on user's locale? how to do that?

thanks

Avatar

Former Community Member

I'm really busy today, but you can make 2 workbench processes and each bind them to a different xpd file. It wouldn't surprise me if you could make it select a different depending on the xml data provided, but I have no time to verify at this very moment, I might later on the day.

Good luck

Avatar

Former Community Member

so, is there any way to get the locale in workbench and base on the information to choose the right process?

Avatar

Former Community Member

Are you asking if a process could determine the locale of the Reader/Acrobat client and render a PDF for that locale?

Avatar

Former Community Member

yes, but i am more interested in the livecycle workspace. when a user open a form from the workspace, can the process get the locale and display the form with the right language?