Author: pbr Date: 2007-06-15 07:32:33 -0700 (Fri, 15 Jun 2007) New Revision: 5426
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzDatapointer.lzs openlaszlo/branches/legals/test/lfc/data/datapointer.lzx Log: Change 20070607-Philip-0 by [EMAIL PROTECTED] 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 Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzDatapointer.lzs =================================================================== --- openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzDatapointer.lzs 2007-06-15 06:44:52 UTC (rev 5425) +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzDatapointer.lzs 2007-06-15 14:32:33 UTC (rev 5426) @@ -1133,7 +1133,17 @@ return p[ pp.operator ] ( pp.operatorArgs ); } - var parts = pp.operator.split("."); + // LzParsedPath.initialize() created pp.operator. If 'attributes', + // don't use split(".") to separate the string because '.' is + // a valid XML character. + var parts; + if (pp.operator.indexOf("attributes.") == 0) { + parts = ['attributes', pp.operator.substr(11)] + } + else { + parts = pp.operator.split("."); + } + var val = p; for (var i = 0; i < parts.length; i++) { var pathElt = parts[i]; Modified: openlaszlo/branches/legals/test/lfc/data/datapointer.lzx =================================================================== --- openlaszlo/branches/legals/test/lfc/data/datapointer.lzx 2007-06-15 06:44:52 UTC (rev 5425) +++ openlaszlo/branches/legals/test/lfc/data/datapointer.lzx 2007-06-15 14:32:33 UTC (rev 5426) @@ -6,6 +6,10 @@ <dataset name="loadme" type="http" src="http:testdata.xml" request="true" trimwhitespace="false"> </dataset> + <dataset name="syntax"> + <data a="avalue" b="bvalue" a.b="a.bvalue"/> + </dataset> + <class name="TestDatapointer" extends="TestCase"> <attribute name="dp2ready" value="false"/> <attribute name="t2del" value="false"/> @@ -16,6 +20,8 @@ <datapointer xpath="loadme:/data" name="dp2" ondata="parent.dp2ready = true"/> + <datapointer xpath="syntax:/data" name="dp3" /> + <method name="test"> this.doIt( dp1 , 'localme'); </method> @@ -126,6 +132,15 @@ ]]> </method> + + <method name="test3"> + assertTrue( true ); + assertEquals( 'data' , dp3.xpathQuery( '/data[1]/name()' ) ); + assertEquals( 'avalue', dp3.xpathQuery( '/data[1]/@a')); + assertEquals( 'bvalue', dp3.xpathQuery( '/data[1]/@b')); + assertEquals( 'a.bvalue', dp3.xpathQuery( '/data[1]/@a.b')); + </method> + </class> </library> _______________________________________________ Laszlo-checkins mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
