I've encountered a problem with some XML that I'm getting from a web service that I've created. The problem occurs when I have to escape an '&' character in one of the attributes of the XML. My XML looks something like this:
<root> <item uri="http://foo.bar.com/blah?foo=bar&blah=baz&boo=yuck"/> </root> My Laszlo program looks like this: <canvas debug="true"> <dataset name="testds" type="http" src="http://localhost:8299/foo/bar" request="true"/> <view height="400" width="600" bgcolor="gray"> <simplelayout axis="y" spacing="20"/> <grid id="test" datapath="testds:/root" contentdatapath="item" height="200" width="${parent.width}" bgcolor1="#EEEEEE" bgcolor0="white" multiselect="false"> <gridcolumn name="uri" text="URI" width="${parent.width}" resizemargin="1" resizable="false"> <text font="Arial" datapath="@uri"/> </gridcolumn> <method name="itemSelected" args="item" event="onselect"> <![CDATA[ var selectedItem = getSelection(); if (selectedItem) { editor.datapath.setFromPointer(selectedItem.dupePointer()); } ]]> </method> </grid> <view id="editor" height="${parent.height - 10}" width="${parent.width - 10}" x="5" y="5" > <datapath/> <simplelayout axis="y" spacing="3"/> <view> <simplelayout axis="x" spacing="3"/> <text width="50" valign="middle">URL</text> <edittext width="500" id="uri" datapath="@uri"/> </view> </view> </view> </canvas> When I run the application, I see the following URI displayed in the Grid control: http://foo.bar.com/blah?foo=bar&blah=baz&boo=yuck The important thing is that the ampersand has been unescaped and is displaying as '&' instead of '&'. This is what I would expect. However, when I click the grid, which then populates my editext field, the URI value displays like this: http://foo.bar.com/blah?foo=bar&blah=baz&boo=yuck I'm not sure why this happened. By way of contrast, if I don't use an HTTP dataset, but rather just hard code the XML inside of the dataset, the URI displays correctly in both the Grid and the edittext field. I first noticed this problem in an editor application that I've written which saves URI information. As long as the URI didn't contain any query parameters things were fine. However, once a URI had multiple parameters (separated by '&'), I started seeing things like this in my database: http://foo.bar.com/blah?foo=bar&amp;blah=baz&amp;boo=yuck after one save, and this: http://foo.bar.com/blah?foo=bar&amp;amp;blah=baz&amp;amp;boo=yuck after two saves, etc. I'm trying to figure out whether the escaping/unescaping problem is something with OpenLaszlo (problem occurs in both 3.2 and 3.3.3) or some misunderstanding on my part about how the escaping should work. Thanks, and sorry for the long post. -- James Howe _______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
