[Laszlo-user] Data Manipulation Confusion

James Howe openlaszlo at wingspread.imap-mail.com
Tue Apr 11 17:41:31 EDT 2006


I've been working on a data related problem for the last few days which  
really has me confused.  I must be missing something.  I'm trying to do  
something very simple.  I have two XML datasets:

<dataset name="ds1">
	<items>
		<item name="foo" address="bar"/>
	</items>
</dataset>

<dataset name="template">
	<items>
		<item name="" address=""/>
	</item>
</dataset>

I have a simple editor which is bound to ds1 with a datapath like this:

datapath="ds1:/items/item"

The user can change things in the editor and save them.  They can also  
select 'New' to start again.  What I've been trying to figure out is how  
to clone the item element from my template dataset and use it to replace  
the edited value found in ds1.  Looking in the documentation I can see how  
I could add the template item to ds1 and then delete the original node  
 from ds1 using the addNodeFromPointer, but then if the user edits the  
values, the values in my template are disturbed.  What I want to do is add  
a deep clone of my template node to the ds1 dataset so that if/when it  
gets edited, my template remains unaffected.

What am I missing?  I can find the node I'm interested in by doing  
xpathQueries.  I can clone the LzDataElement returned from the  
xpathQuery.  Once I have that, I don't see how I can add that element as a  
node in my ds1 dataset.

Any help on this would be greatly appreciated.

Thanks!

-- 
James Howe


More information about the Laszlo-user mailing list