MashZone NextGen 10.2 | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Expressions for Mashups | Defining Custom XPath Functions | Write a Custom XPath Function Class
 
Write a Custom XPath Function Class
You create the function as a Java class that extends com.jackbe.presto.mashup.EMMLUserFunction. See MashZone NextGen Custom XPath API for reference information on this class.
Note: In earlier MashZone NextGen releases, this API was the com.jackbe.jbp.jems.client.EMMLUserFunction class. Any method in your custom class can be used as an XPath function with these limitations:
*The method must be a static class method.
*All parameters for the method must be simple types.
*The return type can be void or any simple type. It cannot return a node or node set.
For example:
package com.mycompany.mashups;
import com.jackbe.presto.mashup.EMMLUserFunction;
public class CustomFunctions extends EMMLUserFunction {
public static boolean soundex(String name, String pattern){
org.apache.commons.codec.language.Soundex s = new;
return s.encode(name).equalsIgnoreCase(s.encode(pattern));
}
}
You must add the following JARs to the classpath to compile your custom XPath Function class:
*web-apps-home/mashzone/WEB-INF/lib/emml.jar
*web-apps-home/mashzone/WEB-INF/lib/presto-api.jar
*web-apps-home/mashzone/WEB-INF/lib/saxon8.jar

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release