History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-3556
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: -- --
Assignee: Mamye Kratt
Reporter: Norman Klein
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Datapath doesn't parse XML attribute correctly

Created: 15/Feb/07 03:02 PM   Updated: 27/Sep/07 08:56 AM
Component/s: LFC - Data
Affects Version/s: 3.3.3
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

Environment: Window XP Professional

Severity: Minor
Fixed in Change#: 5,426
Runtime: N/A
Fix in hand: False


 Description  « Hide
Datapath doesn't handle attributes that contain a period in a consistent manner. Here the "first.name" attribute is used by the datapath to display the text object, but the $path constraint doesn't handle it correctly. A "period" appearing within an XML attribute passes all "well-formed" XML tests, so it is valid XML.

Another way that this data attribute can be accessed with Laszlo is to select the node (whose name contains a period). And then use getAttr to retrieve the value.



Here is a sample program illustrating the problem:

<canvas>
   <dataset name="testDs">
       <list first.name="norman" lastname="klein"/>
   </dataset>

   <text datapath="testDs:/list/@first.name" text="$path{'@first.name()'}"/>
   <text datapath="testDs:/list/@lastname" text="$path{'@lastname()'}"/>
   <simplelayout/>
</canvas>


And it prints

(blank line)
klein

This should be

norman
klein


Thanks, Norman


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Henry Minsky - 24/Apr/07 11:29 AM
I need to verify this in 4.0. At one point we changed how datapaths parsed into attribute accessors, and it would have failed with a "."
because of using 'eval', but I thought I modified that to use foo[bar] syntax instead, so need to check.

P T Withington - 24/Apr/07 11:30 AM
Please verify if still a bug or not in 4.0.

Philip Romanik - 15/Jun/07 07:33 AM
Change 20070607-Philip-0 by Philip@Philip-DC on 2007-06-07 18:03:10 EST
   in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/branches/legals
   for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Parse datapaths with '.'

New Features:

Bugs Fixed: LPP-3556

Technical Reviewer: hqm
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
It turns out that data attributes could not have a '.' in the name,
although this is valid XML. LzDatapointer.__LZprocessOperator() was
using split(".") to separate the operator ('attributes' in this case)
and data. If the operator is 'attributes', the code now uses substr()
to retain the entire line. For other operators, split() is still used.

I modified /test/data/alldata.lzx (see datapointer.lzx) to verify that
attributes can now be read properly. The dataset is:
   <dataset name="syntax">
       <data a="avalue" b="bvalue" a.b="a.bvalue"/>
   </dataset>


Tests:
Test case in LPP-3556
/test/lfc/data/alldata.lzx (swf, dhtml)
/test/smoke/smokecheck.lzx (swf, dhtml)
lzpix

Files:
M test/lfc/data/datapointer.lzx
M WEB-INF/lps/lfc/data/LzDatapointer.lzs

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070607-Philip-0.tar

Mamye Kratt - 06/Jul/07 02:48 PM
(4.0 branch (4.0.3) build r5599)
Closed

Mamye Kratt - 06/Jul/07 02:49 PM
Need to test in legals.

Mamye Kratt - 17/Jul/07 12:16 PM
Need to test in legals.