Hi Michael, I'll try to explain your query from following perspectives: XPath 2.0 language, XPath 2 F&O spec & XSD 1.1 language
And how PsychoPath supports the XPath 2 F&O namespace, and how a host language (like XSD 1.1 or even Java) should handle XPath 2 F&O namespace. I think, the Java code in Xerces-J should not be relevant here, as the host language for XPath 2 function calls here is (i.e, XPath 2 function calls in assertion XPath 2 expressions), the XSD 1.1 Schema language (and not the Java code which is written within Xerces-J). The XPath 2.0 F&O specs defines, that all built in XPath 2 functions exist with the XML namespace, http://www.w3.org/2005/xpath-functions (ref, http://www.w3.org/TR/xpath-functions/#namespace-prefixes). A conforming XPath 2 engine has to statically bind this F&O namespace URI to all the built in XPath 2 implementation code. PsychoPath correctly does this. Here are some PsychoPath internals, which are relevant to this discussion: PsychoPath engine allows a host language (like say a Java program. Here Xerces-J code plays that role) to create namespace bindings (in the XPath 2 static context) for PsychoPath, which are available at runtime. PsychoPath provides a method, "add_namespace" in the PsychoPath inteface StaticContext. "add_namespace" method is also exposed to PsychoPath interface DynamicContext, as also reflected in the code in Xerces class, AbstractPsychoPathImpl.java. This works because, PsychoPath internally does something like, "public interface DynamicContext extends StaticContext". You rightly said, that XPath 2 static context should provide a "Default function namespace" binding as well (described at this link which you cited, http://www.w3.org/TR/xpath20/#dt-def-fn-ns). To answer your following questions: <question> XPath 2.0 processor should allow you to set it to anything, so can't see how it could be working correctly without having code somewhere in Xerces which explicitly sets that on PsychoPath. In other words a call like: fDynamicContext.set_default_function_namespace("http://www.w3.org/2005/xpath-functions"); or whatever the method is in PsychoPath for specifying it. </question> This can be achieved by simply not specifying any namespace binding for the URI http://www.w3.org/2005/xpath-functions in Xerces-J java code. i.e, simply removing this method call in, AbstractPsychoPathImpl.java fDynamicContext.add_namespace("fn", "http://www.w3.org/2005/xpath-functions"); will fix this issue. This statement simply needs to be removed, to comply to the spec, as you stated. So the fix for this problem, seems to be very trivial :) I think, we should also provide a facility in Xerces-J where by if we bind the XPath 2 F&O namespace URI on xs:schema element (say for e.g, like <xs:schema xmlns:fn="http://www.w3.org/2005/xpath-functions" ...), then a Xerces-J component like AbstractPsychoPathImpl.java should create namespace binding for URI http://www.w3.org/2005/xpath-functions with prefix "fn", as for this example (or whatever this prefix is, as defined on xs:schema element). i.e, AbstractPsychoPathImpl should not hardcode any namespace binding for URI, http://www.w3.org/2005/xpath-functions. But instead should create a binding only if, a namespce declaration is present on xs:schema. I think, this can be technically implemented by the solution that we will arrive at, for the XSD 1.1 prefix that we are discussing just now. I hope this response is clear enough, and could answer your queries. Please let us know, if something is still missing. On Thu, Nov 12, 2009 at 9:31 PM, Michael Glavassevich <[email protected]> wrote: > Hi Mukul, > > I'm afraid I don't follow how that could work. I see nothing in the code > which sets the default function namespace [1] to be > "http://www.w3.org/2005/xpath-functions". XML Schema 1.1 [2] fixes its value > to be "http://www.w3.org/2005/xpath-functions", but an XPath 2.0 processor > should allow you to set it to anything, so can't see how it could be working > correctly without having code somewhere in Xerces which explicitly sets that > on PsychoPath. > > In other words a call like: > > fDynamicContext.set_default_function_namespace("http://www.w3.org/2005/xpath-functions"); > > or whatever the method is in PsychoPath for specifying it. > > Thanks. > > [1] http://www.w3.org/TR/xpath20/#dt-def-fn-ns > [2] http://www.w3.org/TR/2009/CR-xmlschema11-1-20090430/#sec-xpath-valid > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [email protected] > E-mail: [email protected] -- Regards, Mukul Gandhi --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
