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.

SaveXML and LoadXML problem

Avatar

Former Community Member

Hi,

I have been trying to solve this problem..but no solution so far.

This is the essence of the requirement

When a user enters a value (suppose HELLO) in TextField1 and clicks on SAVEXML button. it converts the entry to XML and stores in a text box say textField2. Now I go and edit the value inbetween the XML tag from HELLO to HI,, and hit on another button to load the XML back to the textfield1, then it should load as HI.... but nothing is happening... Please advice if I am doing anything wrong in Syntax.

I am using live cycle 8.0

The syntax I am using to saveXML in

var

sXML = xfa.form.data.Page_1.TextField1.saveXML();

TextField2.rawValue

= sXML;

Syntax I am using to load XML...

var

dataToLoad = TextField2.rawValue;

xfa.datasets.data.loadXML(dataToLoad

,0,1);

nothing is working...

5 Replies

Avatar

Former Community Member

You are saving the data from a single field but replace the entire data dom. I woudl do save the xml from the same node that you are loading to. So when you save use xfa.dataset.data.saveXML() and when you load use xfa.datasets.data.loadXML(datatoLoad,0,1)

Paul

Avatar

Former Community Member

Thanks Paul... Lemme check this and let u know.

Avatar

Former Community Member

I did try your option Paul, but it did not work. when I convert to XML using the code provided by you, thed data entered in the textbox is not to be seen when I view it.

I am saving the entered value in the text field as XML string and passing the value to a textfield just to view the XML. Now I edit the XML to change the entered values. Suppose I entered HEllo and I create the XML, then I try to change it to HI in the XML code. Now I hit on LoadXML to load this XML back to that field. So now I need to see HI in the field. but it is not reflecting.

I use the following code to saveXML -

var

sXML = data.Page_1.TextField1.saveXML();

TextField2.rawValue

= sXML;

and to a load back I use -

var

dataToLoad = TextField2.rawValue;

app.alert(dataToLoad);

data.TextField1.loadXML(dataToLoad

,0,1);

saveXML.GIF

But it doesnt seem to work. Any idea on how to make this work. Your suggestions are appreciated and rewarded.

Avatar

Former Community Member

You are making the same mistake ......I created a sample for you. I am using a field to store the XML so you can see what it

looks like .....a variable will work as well.

paul

Avatar

Former Community Member

Paul.   I really appreciate your reply and thanks for the effort on that form. I feel somehow things are different in my form as I am using livecycle on SAP platform with a SAP interface. But, I managed to solve the problem in a different way.

Thanks once again..