Yes, its time. Time to make that move to XPath 2.0 - I've previously mentioned the need to upgrade SketchPath from XPath 1.0, and now seems to be about right. XPath 1.0 will of course continue to be supported - and features added as required.
I've decided to go for Saxon.Net as the XPath 2.0 processor for SketchPath. There are three main reasons:
1. Saxon is well established as a standards compliant processor, for XPath, XSLT and XQuery
2. A good repuation for processing Performance - especially the more highly optimised SA version
3. Very good documentation for the Saxon.Net API, and as I'm finding now, an API that is well suited to the SketchPath task: Evaluating XPath without the benefit of a 'host' language like XSLT and XQuery.
How far have I got? Well, its early days, and the first priority was to get the basic functionality in place before added more advanced features in future releases. So, the main changes to date:
1. There's a new item to choose when selecting the expression engine, so you can now choose Regex, XPath 1.0 and XPath 2.0 - Also the settings pane has been extended to allow the setting of the default XPath processor.
2. The results list now lists the atomic types as specified by the XPath 2.0 Data Model (XDM)
3. When XPath 2.0 is selected instead of XPath 1.0, the Assist Pane is modified to reflect changes to the XPath language.
3.1 The column used for the 4 pages of XPath 1.0 functions is instead used to show 4 pages of XPath operators that are grouped (loosely) according to category - A 5th page will probably be added later for XPath type operators such as 'cast as'.
3.2 The Intelli-List will now list all XPath 2.0 functions alphabetically, so they can be auto-selected when typing in the expression editor. Typing 'fn:' in the XPath editor or clicking the 'fn:' column heading populates the function list ready for selection
3.3 A new 'document-node' node-test has been added to the node-tests column
4. The most challenging (and interesting) task so far:
Modifying the built-in XPath parser that is used to colorize the expression, provide Intellisense and allow XPath expression tracing. There are many new operators to consider but the new sequence operations using for $, every $ and some $ proved especially challenging - effectively they create a localised variable whose context must be established and then maintained no matter how deeply nested within predicates or functions. Further testing on this required but early signs are good.
The 'To Do' List
Having completed an initial (successful but not published) early proof of concept for the forthcoming Schema-Aware version, I'm now reverting back to adding extra refinement to the basic features, so on the list I've got the following:
1. Provide 'mouse-hover' help for each of the XPath functions
2. Allow tabs and line-feeds to be inserted into the expression - for formatting purposes
3. Support XPath 2.0 comments
4. Add a 'smart' mode so that expressions are not evaluated continuously if an item is being selected from the Intelli-List
5. Provide an auto-format feature in the XPath editor to allow nested parts to be indented on new lines
6. Add a 'high-light matching bracket feature - expressions are getting longer and they need this feature now.
Well, thats a list that should help serve as reminder to me - other requirements are associated with improving the file load performance and increasing the file-size capacity of SketchPath, 100 KB files are the current useful maximum.
I will try to put in some Saxon.Net code samples here later if there's any interest shown.
If you want to give it a go, the XPath 2.0 technical-preview (pre-production) version of SketchPath is now available for download from a link from the main SketchPath page - note that because its pre-production it is not on the main downloads page.
Tuesday, 1 April 2008
Subscribe to:
Posts (Atom)