Go Back   OpenLaszlo Developers Forums > Programming in OpenLaszlo > OpenLaszlo Datasets

OpenLaszlo Datasets Working with OpenLaszlo datasets? Ask your questions here.

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-28-2012, 09:43 AM
kmeixner kmeixner is offline
Senior Community Member
 
Join Date: Dec 2006
Location: Toronto, Ontario, Canada
Posts: 636
kmeixner is on a distinguished road
Hi,

If I am not mistaken, your XPath syntax is correct, but apparentlly OpenLaszlo does not interpret it correctly:

Code:
(canvas.myData.getPointer()).xpathQuery("/myXML/person[lastName='Simpson']/lastName")
Returns:

Quote:
«Array(3)#54| [<lastName>Simpson</lastName>, <lastName>Simpson</lastName>, <lastName>Burns</lastName>]»
You could get an array of all of the last names and figure out which one's are matches using:

Code:
(canvas.myData.getPointer()).xpathQuery("/myXML/person/lastName/text()")
Which would return:

«Array(3)#55| ['Simpson', 'Simpson', 'Burns']»

or alternatively use attributes instead:

Code:
<canvas width="1000" height="584" debug="true">

<dataset name="myData">
<myXML>
<person show="simpsons" firstName='Homer' lastName='Simpson'>
</person>
<person show="simpsons" firstName='Marge' lastName='Simpson'>
</person>
<person show="simpsons" firstName='Montgomery' lastName='Burns'>
</person>
</myXML>
</dataset>

</canvas>
Quote:
(canvas.myData.getPointer()).xpathQuery("/myXML/person[@lastName='Simpson']")
Returns:

«Array(2)#0| [<person show="simpsons" firstName="Homer" lastName="Simpson"/>, <person show="simpsons" firstName="Marge" lastName="Simpson"/>]»


OpenLaszlo's implementation of XPath is incomplete, possibly that is why your original XPath query does not work.

Kevin
__________________
Me: Stack Overflow | Assembla | Twitter | LinkedIn | www.kevinmeixner.com
Company: Web | Facebook | Twitter

Last edited by kmeixner; 03-28-2012 at 09:44 AM. Reason: move end code markup to correct spot
Reply With Quote
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:25 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.