Highlighted

Reading information from XML files

Avatar

Guest

24-02-2009

I have created a document where the user has the possibility to export a XML-file by clicking on a button.

Is it somehow possible to load this data so I can enter its content back into the document? (maybe by using loadXML()? I could not find any useful help to this method anywhere).

Replies

Highlighted

Michael_Eisenma

24-02-2009

If you know the name of the file - you can add a load button ...

and in its "click" method ... insert the line ...



xfa.host.importData("c:/PDFFILENAME.pdf");



this will allow the XML content to be loaded by the form ...

but each of the XML fields that you want ot load into the form must be bound to form so that the laod can function properly.
Highlighted

Avatar

Guest

24-02-2009

Thank you, so far this seems to work for me.

However, when testing this on another Computer, I noticed that this does not work if LiveCycle Designer is not installed. This concerns xfa.host.importData() and xfa.host.exportData(). Is there another way to save and open XML-files? It would be useful to have this possibility even on Computer without LC.
Highlighted

pguerett

25-02-2009

It has nothing to do with Designer being installed. I am guessing that on those other machines that you are running Reader. To save data out of a form using Reader the form must be Reader Extended to allow this.
Highlighted

Avatar

Guest

25-02-2009

Actually, I am looking for a possibility for every user to save XML code and eventually load it back in without having to download/buy any further programs.



I now had the idea to generate XML code in a textfield when the user clicks on a button. This code can be copied in an extern .txt file so every piece of information can be stored - even if the document is closed. It is also possible to reenter this code into the textfield and click on another button which uses the loadXML() function.



This works pretty good except for images. Saving the rawValue of an image would create hundreds of lines of source code... so now all I need to know is how to keep the information of an image field (It can display multiple images, depending of the users choice).