While updating the SWF RPC code to legals, I encountered a strange
difference in the matching
of an XPATH. In one of the test apps, test/rpc/javarpc/serverenv.lzx, there
is some code which maps
a returned dataset onto a list for display. The dataset is created from a
hashtable, using a utlity in LzDataElement
called valueToElement:


/**
 * Get LzDataElement representation of primitive type, array, or object
value.
 */
function valueToElement ( o ) {
   var n = new LzDataElement("element", { }, this.__LZv2E(o));
   return n;
}

/**
 * @param Type o: primitive type, array, or object value.
 * @return array of LzDataElements
 * @access private
 */
function __LZv2E ( o ) {

In both trunk and Legals, this returns a dataset which looks like this
(simple example)

lzx> LzDataElement.prototype.valueToElement([1,2,3])
«LzDataElement#9#16|
<element><item>1</item><item>2</item><item>3</item></element>»

In the test app, there's a dataset named envDset which gets bound to the
dataset from valueToElement ().

In trunk, the XPATH which matches against all the values for that dataset is
just "envDset:/*", whereas in Legals,
I had to make that XPATH say "envDset:/element/*". It seems like in trunk,
the outer element of the dataset
"does not count" for xpath queries, whereas in Legals it does? I had to
change the code in the test app as shown below
to get it to map over all the dataset child nodes

trunk:
   <list name="env" width="250" height="200">
       <textlistitem name="ti" datapath="envDset:/*"
text="$path{'name()'}">
           <method event="onselect">
               canvas.display.setText(datapath.xpathQuery('text()'))
           </method>
       </textlistitem>
   </list>


legals:
   <list name="env" width="250" height="200">
       <textlistitem name="ti" datapath="envDset:/element/*"
text="$path{'name()'}">
           <method event="onselect">
               canvas.display.setText(datapath.xpathQuery('text()'))
           </method>
       </textlistitem>
   </list>

Anyone seen something like this before? Seems pretty fundamental
incompatibility to just run into now... Maybe
there's something funny about the dataset that is being created?


--
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to