Hi Michael, Thanks for the explanation. Now I think, I understand the concepts in relation to this thread.
I'll update the Xerces assertions code based on the explanation you've given below. I'll update the list, when I have completed the code changes. On Sun, Nov 15, 2009 at 10:32 AM, Michael Glavassevich <[email protected]> wrote: > Hi Mukul, > > I stand by what I said before. The namespace bindings for the schema and F&O > namespaces have no special standing. You may potentially need all of the > in-scope namespace at the assert element in order to process the XPath. If > PsychoPath is only made aware of those two namespaces how could it ever > process an XPath like "@my:length eq fn:count(./a:children/b:grandchildren)" > correctly (where "my", "a" and "b" are bound to other namespaces in the > user's schema)? PsychoPath can't know what those bindings are unless it's > explicitly told what they are. > > The static context does include all the in-scope namespaces. See section > 3.13.6.2 in the spec [1]: > > 2.2 The static context is given as follows: > ... > 2.2.2 The statically known namespaces is the {namespace bindings} of X. > 2.2.3 The default element/type namespace is the {default namespace} of X. > 2.2.4 The default function namespace is > http://www.w3.org/2005/xpath-functions. > ... > > where {namespace bindings} is defined [2] as: "A set of Namespace Binding > property records. Each member corresponds to an entry in the [in-scope > namespaces] of the host element, with {prefix} being the [prefix] and > {namespace} the [namespace name]." > > This has to be captured from the schema document and communicated to the > XPath processor in order to have a correct implementation. The opportunity > to retrieve the in-scope namespaces is in the traverser. For example: > > NamespaceSupport namespaceContext = schemaDoc.fNamespaceSupport; > Enumeration currPrefixes = namespaceContext.getAllPrefixes(); > while (currPrefixes.hasMoreElements()) { > String prefix = (String)currPrefixes.nextElement(); > String uri = namespaceContext.getURI(prefix); > // Store each prefix mapping on the XSAssert component. > ... > } > > Hoping that makes sense. > > Thanks. > > [1] http://www.w3.org/TR/2009/CR-xmlschema11-1-20090430/#sec-xpath-valid > [2] http://www.w3.org/TR/2009/CR-xmlschema11-1-20090430/#declare-assertion > > 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]
