Re: free marker issue, Expecting a string, date or number here, Expression instead a freemarker.ext.dom.NodeListModel
"Newman, John W" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <D688C4D318A63D4290AA94A33E06F7D20282802DF4@msxmbxnsprd14.acct.upmchs.net> |
I get that message if an attribute doesn't exist. Make sure it is in the xml and you have the spelling and case correct.
Also in the docs you'll see
${(element.@Attr)!'Undefined'}
Will never give you undefined since @Attr always exists as a 'Node List Model', regardless of whether or not your xml has it.
So you have to check for [0] in the list.. essentially I always use [0] on attributes.
${(element.@Attr[0])!'Undefined'}
Correct me if I'm wrong, but in xml I believe you can't have <Element Attr="one" Attr="two" />, you'll get a 'duplicate attribute' parsing error. So why then is @Attr a list with [0], [1], ... [N] .. Why would @Attr ever have more than one value? What am I missing?
-----Original Message-----
From: Denis Bredelet [mailto:[email protected]]
Sent: Saturday, February 06, 2010 2:53 AM
To: FreeMarker-user
Subject: Re: [FreeMarker-user] free marker issue, Expecting a string, date or number here, Expression instead a freemarker.ext.dom.NodeListModel
On Friday, February 05, 2010, at 05:33PM, "dingi" <[email protected]> wrote:
>
>i am getting this error all the time.
>
>I have one attribute, which has date in it. The node is there, but when I
>try to access value, it always returns thie error.
>
>Can anybody help? Please.
I can't read your message but--
Are you sure there is no more than one gamedate? I suppose tickers["ticker-entry/gamestate"] could be a list.
See http://freemarker.org/docs/xgui_imperative_learn.html
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com