commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james_strac...@yahoo.co.uk>
Subject Re: [jelly] a bug? or am I missing something
Date Tue, 15 Apr 2003 23:56:50 GMT

On Tuesday, April 15, 2003, at 04:37  am, Warner Onstine wrote:

> Ugg, no kidding. Can you think of any other way to loop through 
> selection of
> xml nodes?


How about

<x:forEach  select="/database/table">
	<x:set var='name' select="@class">
	...

i.e. iterate over XML using XPath. Note that the XPath expressions are 
relative (e.g. @class)



>
> -warner
>
> On 4/14/03 8:16 PM, "Ben Walding" <ben@walding.com> wrote:
>
>> This is a pecularity of jexl I believe.
>>
>> "size" is some kind of reserved word in the parser.
>>
>> I posted last week having the same kind of problem
>>
>> Solution?
>>
>> The ugly way it to have a wrapper bean
>>
>> $bean.syze($table)
>>
>> but that is so ugly it makes me want to choke myself to death with a
>> rotting couch cover.
>>
>>
>> Warner Onstine wrote:
>>
>>> Ok, I'm basically trying to duplicate some stuff from xsl land here 
>>> and am
>>> having some serious problems.
>>>
>>> Here's my jelly snippet:
>>> <x:set var="tables" select="database/table"/>
>>>
>>> <j:forEach indexVar="index" begin="1" end="${tables.size()}" step="1"
>>> items="${tables}" trim="no">
>>>    <x:set var="currentTable" select="/database/table/[$index]"/>
>>>    <j:set var="className"><x:expr
>>> select="$currentTable/@className"/></j:set>
>>>    <vel:merge name="${outputDir}/${className}Peer.php" 
>>> basedir="templates"
>>> readOnly="true" template="classes/peer.vm"/>
>>>    <vel:merge name="${outputDir}/Base${className}.php" 
>>> basedir="templates"
>>> readOnly="true" template="classes/base.vm"/>
>>> </j:forEach>
>>>
>>> Now, here's the problem I am running into:
>>> 55 [main] ERROR parser.XMLParser  - Caught exception:
>>> org.apache.commons.jelly.JellyException: null:-1:-1: <null> 
>>> Encountered ".
>>> size" at line 1, column 7.
>>> Was expecting one of:
>>> ------------
>>> Now, through all the examples I've read this should work. $tables is 
>>> an
>>> ArrayList and has the method size().
>>>
>>> Any reason why this isn't working?
>>>
>>> -warner
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

James
-------
http://radio.weblogs.com/0112098/


Mime
View raw message