halfstep
01-03-2008, 10:12 AM
Hi, I'm using Chapter 38 of the guide to help add a node to a datapath from a form.
In my xml, the code looks like this:
<instance><serverUrl>http://whatever.com:8080</serverUrl><version>1.0</version></instance>
When I run the code its generating something that looks like this:
<instance serverUrl="http://whatever.com:8080" version="1.0"/>
I'm just wondering what I can do to have it create children elements instead of setting the editext value to an attribute.
Here is the code in my form:
<boxview name="newData" width="${parent.width * .95}" bordersize="1" xoffset="${parent.width * -.01}" yoffset="${parent.width * -.01}" datapath="new:/instance">
<simplelayout axis="y" spacing="0"/>
<boxview width="${parent.width}" bordersize="0" bgcolor="0x150F54" fgcolor="0xFFFFFF">
<text>Register Server Instance</text>
</boxview>
<view width="${parent.width}" height="100" bgcolor="0xDDDDDD" align="center">
<simplelayout axis="x" spacing="10"/>
<boxview bordersize="0" width="${parent.width * .25}">
<simplelayout axis="y" spacing="15"/>
<view><text width="${parent.width}">Service Endpoint:</text></view>
<view><text width="${parent.width}">Version:</text></view>
</boxview>
<view width="${parent.width/2}">
<simplelayout axis="y" spacing="15"/>
<edittext name="serviceUrl" width="${parent.width}" datapath="@serviceUrl"></edittext>
<edittext name="version" width="${parent.width}" datapath="@version"></edittext>
</view>
</view>
</boxview>
<datapointer name="insertPoint" xpath="myServices:/serviceFamily/service[1]"/>
<button style="blueComponents" align="right" width="${parent.width * .1}" xoffset="${parent.width * .01}" yoffset="${parent.width * -.03}" height="20">
<handler name="onclick">
Debug.write('starting to add to the dataset');
var dp = parent.insertPoint;
dp.selectChild();
parent.newData.datapath.updateData();
Debug.write(parent.newData.datapath);
dp.addNodeFromPointer(parent.newData.datapath);
Debug.write(dp);
</handler>
<text valign="middle" align="center" fgcolor="0xFFFFFF">Next</text>
</button>
In my xml, the code looks like this:
<instance><serverUrl>http://whatever.com:8080</serverUrl><version>1.0</version></instance>
When I run the code its generating something that looks like this:
<instance serverUrl="http://whatever.com:8080" version="1.0"/>
I'm just wondering what I can do to have it create children elements instead of setting the editext value to an attribute.
Here is the code in my form:
<boxview name="newData" width="${parent.width * .95}" bordersize="1" xoffset="${parent.width * -.01}" yoffset="${parent.width * -.01}" datapath="new:/instance">
<simplelayout axis="y" spacing="0"/>
<boxview width="${parent.width}" bordersize="0" bgcolor="0x150F54" fgcolor="0xFFFFFF">
<text>Register Server Instance</text>
</boxview>
<view width="${parent.width}" height="100" bgcolor="0xDDDDDD" align="center">
<simplelayout axis="x" spacing="10"/>
<boxview bordersize="0" width="${parent.width * .25}">
<simplelayout axis="y" spacing="15"/>
<view><text width="${parent.width}">Service Endpoint:</text></view>
<view><text width="${parent.width}">Version:</text></view>
</boxview>
<view width="${parent.width/2}">
<simplelayout axis="y" spacing="15"/>
<edittext name="serviceUrl" width="${parent.width}" datapath="@serviceUrl"></edittext>
<edittext name="version" width="${parent.width}" datapath="@version"></edittext>
</view>
</view>
</boxview>
<datapointer name="insertPoint" xpath="myServices:/serviceFamily/service[1]"/>
<button style="blueComponents" align="right" width="${parent.width * .1}" xoffset="${parent.width * .01}" yoffset="${parent.width * -.03}" height="20">
<handler name="onclick">
Debug.write('starting to add to the dataset');
var dp = parent.insertPoint;
dp.selectChild();
parent.newData.datapath.updateData();
Debug.write(parent.newData.datapath);
dp.addNodeFromPointer(parent.newData.datapath);
Debug.write(dp);
</handler>
<text valign="middle" align="center" fgcolor="0xFFFFFF">Next</text>
</button>