Hopefully someone can help me understand this:

All of the examples of adding a new XML node to a dataset through databinding are based
upon a simple XML element and setting the attributes of that Element. I haven't seen anything that's a bit more
complex involving multiple XML elements deep.

For example, look at the example from the developer documentation (/lps-3.1/docs/guide/data_app.html#d0e21229):

<canvas height="400" width="700" bgcolor="#D4D0C8">
<dataset name="dset">
<phonebook>
<contact firstName="Joe" lastName="Smith" phone="617-536-7855" email="[EMAIL PROTECTED]" />
</phonebook>
</dataset>
<simplelayout axis="y"/>
<view>
<simplelayout axis="y"/>
<text >New Entry...</text>
<view name="newContact" datapath="new:/contact"
visible="false" x="20" height="120">
<text y="10">First Name:</text>
<edittext name="firstName" datapath="/firstName" x="80" y="10"/>
<text y="35">Last Name:</text>
<edittext name="lastname" datapath="@lastName" x="80" y="35"/>
<text y="60">Phone:</text>
<edittext name="phone" datapath="@phone" x="80" y="60"/>
<text y="85">Email:</text>
<edittext name="email" datapath="@email" x="80" y="85"/>
<button width="80" x="200" y="10">Add
<method event="onclick">
parent.datapath.updateData();
var dp=canvas.datasets.dset.getPointer();
dp.selectChild();
dp.addNodeFromPointer(parent.datapath);
parent.setDatapath("new:/contact");
t.setText(dset.serialize());
</method>
</button>
</view>
</view>
<inputtext multiline="true" width="${canvas.width}" bgcolor="0xa0a0a0" id="t" height="300"/>
</canvas>

 

For the dataset in use, if we change "firstName" from being an attribute to an XML Element such as:
<contact lastName="Smith" phone="617-536-7855" email="[EMAIL PROTECTED]">
<firstName>joe</firstName>
</contact>

and update the binding on the newContact view from @firstName to:
<edittext name="firstName" datapath="/firstName" x="80" y="10"/>

It doesn't work. Nor does the XPath expressions, "./firstName" or "firstName".

 

And if we change above code as:

<contact lastName="Smith" phone="617-536-7855" email="[EMAIL PROTECTED]">
<firstName>joe</firstName>

<address-list>

   <address>123<address>

   <address>123<address>

</address-list>
</contact>

I don't know how to deal with it!

 

Can anyone tell me or point me to an example that deals with something like this.thanks!








完 全 免 费 & 无 限 容 量 = 你 的 网 易 相 册
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to