Attribute processor name case-sensitivity

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Attribute processor name case-sensitivity

Zemi
Administrator
At programming a new attribute processor, I've found problems when attribute name is not lowercase, i.e., attribute names like

   < span my:exampleAttribute="..." >

do not resolve properly.

Is this a bug or a feature?

If this is the expected behavoir, maybe it could be documented on the "Extending Thymeleaf" tutorial.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Attribute processor name case-sensitivity

danielfernandez
Administrator
Hi.

This was a bug. Parts of the Thymeleaf DOM processing algorithms were supposing case-insensivity while others were acting in the opposite way.

XML is meant to be case-sensible (although HTML4 wasn't), so this has been fixed by making sure all parts of Thymeleaf are case-sensible.

A new snapshot release has been produced: 1.0.0-beta5-20110702.223819-1 (1.0.0-beta5-SNAPSHOT)

Thanks,
Daniel.
Reply | Threaded
Open this post in threaded view
|

Re: Attribute processor name case-sensitivity

Zemi
Administrator
Thanks for the response.

However, I am still having problems when using no-lowercase attribute names.

When my attribute processor is invoked through the method
 
    public AttrProcessResult process(
            final Arguments arguments,
            final TemplateResolution templateResolution, final Document document,
            final Element element, final Attr attribute) {

the argument "attribute" is null.

I've tested it with snapshots
   thymeleaf: 1.0.0-beta5-20110702.223819-1
   thymeleaf-spring3: 1.0.0-beta5-20110702.224121-1

Reply | Threaded
Open this post in threaded view
|

Re: Attribute processor name case-sensitivity

danielfernandez
Administrator
Hi,

That's quite strange... that is, in fact, the error you should have been receiving *before* using this latest snapshot version, but it should be working right now. I've just tested a modification of the "sayhello" example application with a "sayToPlanet" attribute and it works perfectly...

Could you please tell me the value that is being output for your attribute at configuration start time and also paste your "getAttributeApplicabilities()" method for that attribute processor?

With "value being output for your attribute at configuration start time" I mean the log line (in DEBUG mode) being output like:

[THYMELEAF]         * "hello:sayToPlanet" [11000]: thymeleafexamples.sayhello.dialect.SayToPlanetAttrProcessor

Btw, I've uploaded a new snapshot. It doesn't change anything regarding this topic, but if you want to make sure you are using the latest 1.0.0-beta5 snapshot you can set your dependency to version "1.0.0-SNAPSHOT" instead of the specific version of the snapshot. This will make maven always check the latest version.

Regards,
Daniel.
Reply | Threaded
Open this post in threaded view
|

Re: Attribute processor name case-sensitivity

Zemi
Administrator
Hi again.

I've tested it with the following snapshots
   thymeleaf-1.0.0-beta5-20110703.174148-2.jar
   thymeleaf-spring3-1.0.0-beta5-20110703.174405-2.jar
(and I double-checked these are the versions in my classpath), and it works perfectly, so I think I had a .jar cache issue.

Sorry for the mistake and thanks for your work.
Reply | Threaded
Open this post in threaded view
|

Re: Attribute processor name case-sensitivity

danielfernandez
Administrator
Good to know it works for you now.

By the way, I mistakenly said "version 1.0.0-SNAPSHOT" in my last message when I meant "1.0.0-beta5-SNAPSHOT". That is the version value you have to use to make sure Maven is always using the latest snapshot of the future beta5.

Regards,
Daniel.
Reply | Threaded
Open this post in threaded view
|

Re: Attribute processor name case-sensitivity

Zemi
Administrator
Just for the sake of documentation, I've found the cause of my error.

I have Thymeleaf source code opened as a Netbeans project and in my own project Netbeans ignores the thymeleaf .jar and uses Thymeleaf source code (which was not updated to beta5).