monogatari

« The truth on RELAX NG, XML Schema and XML serialization | Main | XPathDocument Changes »

Wondering around CLI function support for XQuery

Am on designing something like CLI native function call support in our XQuery engine. Right now the code below runs with our cvs version.

XQueryCommand cmd = new XQueryCommand (); cmd.Compile (new StringReader (@" declare namespace math='System.Math'; declare function math:Log10($arg as xs:double) as xs:double external; <doc>{math:Log10(number(5.5))}</doc>")); cmd.Execute ((IXPathNavigable) null, XmlWriter.Create (Console.Out));

(sorry for those who disables JavaScript - '<' is incorrectly escaped.)

$ mono func.exe <doc>0.740362689494244</doc>

The original idea is from SAXON 8.0 that supports Java method invokation (and yes, it also looks like IXsltContextFunction). Currently my implementation immediately infers every external functions as native public static methods, and I don't like this design (especially "everything is CLI method" design, and the point that we must define every functions. It could be easy module imports).

I wonder how Microsoft developers think about XQuery extensions.

|