cancel
Showing results for 
Search instead for 
Did you mean: 

ECMAScript for XML (e4x) in Alfresco

randomman
Champ in-the-making
Champ in-the-making
I was thinking it'd be quite handy to manipulate XML in an alfresco script. After a quick google moment I discovered E4X.

That looked pretty cool and it turns out it's supported by Rhino 1.6! But not the 1.6 in Alfresco 2.1, unfortunately - that's R4. What you need is R7. All you need to do is download the R7 jar and stick in your lib directory, restart Alfresco (not sure if that's necessary, but i did it anyway) and hey presto, you're in xml country!

Here's my easy step-by-step guide:

1. Download rhino1_6R7.zip from here.
2. Unpack it and rename js.jar to rhino-js-1.6R7.jar so it's easier to see what it is.
3. Copy it into alfresco/tomcat/webapps/alfresco/WEB-INF/lib or whatever your equivalent directory is.
4. Restart Alfresco.

There's some documentation here  and a quick tutorial on W3 Schools. There's also examples in that Zip you download from Mozilla.org.

It seems quite neat. Is there any plan to include this newer release in future Alfresco builds (if it's not already)?
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
Indeed. We have already upgraded Rhino on the HEAD SVN codeline for exactly this reason.

Thanks,

Kevin

tommorris
Champ in-the-making
Champ in-the-making
Related:
http://issues.alfresco.com/browse/AR-1720

Looks like it works in alfresco version 2.2 enterprise onwards.

pmonks
Star Contributor
Star Contributor
It also works in Alfresco 2.1, but the workaround listed in http://issues.alfresco.com/browse/AR-1720 needs to be manually applied.