Re: [Wtp-wst-dev] XPath 2.0 User Doc Plugin
Nice done, tying the Wiki part to the distributed docs.
However, it reminds me that I would really like to change some parts of API. The overall changes I'll propose are these:
A1) Turn ResultSequence into an interface, and make it immutable, i.e. no more clear(), add(), and concat().
A2) Provide simple implementations for the the empty sequence, singleton sequences, and fixed length sequences.
A3) Introduce a class ResultBuilder which has the methods required for building a ResultSequence.
A4) Introduce a ResultSequence.modify() which returns a ResultBuilder and provide copy-on-use semantics, w.r.t. the underlying List.
We are mixing the elements of the dynamic and static contexts - I can't see how that's good for the adopters. Example when using XPath for Schema 1.1:
- On loading the grammar, a static context is produced, one for each XPath _expression_ (since e.g. namespace prefixes are going to be different). It may make sende for Xerces to provide their own StaticContext, so the shared parts like function libraries are shared, but e.g. the namespaces can differ. Then, for each assertion in a parse/validation run, a dynamic context is in use, and has to "adhere to" the static context of that _expression_.
The proposed changes are then:
- Change DefaultDynamicContext to delegate to the DefaultStaticContext instead of extending it. Or just provide a "getStaticContext" getter instead.
C) Functions coupled to the static and even the dynamic contexts. This prevents sharing of function libraries. Rather, we should pass the dynamic context in when evaluating (especiallly if we add the getStaticContext to the DynamicContext interface?)
D) Cosmetic: why are the function names not camelCase, but underscoreRidden ? shouldn't we at least mimic the style of the DOM standards, e.g. http://www.w3.org/TR/DOM-Level-3-XPath/java-binding.html
which is obviously for XPath 1.0, but still worth looking at?
Comments, anyone? Unless someone objects, I'll open a bug for each of A-D and submit suggested patches and explanations.