Object result = getValueFromTypeValuePair(jsCall(target, method, jsArgs));
return convertFromJavaScript(result, context.getConfiguration());
} catch(Exception e2) {}
}
// if we get this far then throw exception - recovery failed
throw(new XPathException("JavaScriptException in ixsl:call(): Object does not support property or method '" +
method + "' with " + (argument.length - 2) + " argument(s)."));
}
} else {
throw(new XPathException("JavaScriptException in ixsl:call(): Call target object is null or undefined"));
}
} else if (localName.equals("get")) {
ValueRepresentation itemVal = (ValueRepresentation)argument[0].evaluateItem(context);
JavaScriptObject target = (JavaScriptObject)convertToJavaScript(itemVal);
if (target != null) {
String property = argument[1].evaluateAsString(context).toString();
Object result;
try {
result = getValueFromTypeValuePair(jsSplitPropertyTypeAndValue(target, property));
} catch(Exception e) {
throw(new XPathException("JavaScriptException in ixsl:get() for property: " + property));
}
return convertFromJavaScript(result, context.getConfiguration());
} else {
throw(new XPathException("JavaScriptException in ixsl:get(): Get target object is null or undefined"));
}
} else if (localName.equals("page")) {
return SingletonIterator.makeIterator(context.getConfiguration().getHostPage());
} else if (localName.equals("source")) {
return SingletonIterator.makeIterator(context.getController().getSourceNode());
} else if (localName.equals("event")) {
Event event = (Event)context.getController().getUserData("Saxon-CE", "current-event");
return SingletonIterator.makeIterator(new JSObjectValue(event));
} else if (localName.equals("parse-xml")) {
String data = argument[0].evaluateAsString(context).toString();
return convertFromJavaScript(XMLDOM.parseXML(data), context.getConfiguration());
}else {
// previously there was no warning - strictly - this should be caught at compile time
logger.warning("No such IXSL function: '" + localName + "' - empty sequence returned");
return EmptyIterator.getInstance();
} // end of else
} // end of try block
catch(XPathException e) {
e.maybeSetLocation(this.getSourceLocator());
e.maybeSetContext(context);
throw e;
} catch(Exception e) {
XPathException xe = new XPathException("Exception in ixsl:" + localName + "() " + e.getMessage());
xe.maybeSetLocation(this.getSourceLocator());
xe.maybeSetContext(context);
throw xe;
}
}