The W3C Databinding Patterns Working Group has been working for a while now on a set of patterns to assist the development of XSD and WSDL that can be fully exploitied by 'State of the Art' Databinding tools.
Each 'Pattern' has a name, a group, a policy identifier and, most importantly from the SketchPath perspective, an XPath 2.0 expression that defines the pattern in terms of the XSD structure. This Pattern data can be mapped directly to the metadata used in SketchPath library files.
Screenshot: SketchPath with 280 Databinding Patterns Loaded
The latest published Patterns specification is in two parts, Basic and Advanced. In total, it comprises 280 such patterns with associated data.
All the patterns can be viewed at http://www.w3.org/2002/ws/databinding/patterns/6/09/
SketchPath can be used with the Databinding patterns data in two distinct roles:
1. An XPath library development and management tool.
2. An XPath based document conformance checker
The Screenshot above shows SketchPath with all 280 patterns expressions and associated data loaded.
Databinding Patterns Updated via HTTP
Loading the Databinding patterns into SketchPath from an online copy of patterns.xml is performed via http using a special import feature. A set of XPath expressions used for the import are downloaded at the same time as the patterns.xml file. On import, these manage how the patterns are grouped and what comments are associated with each pattern. If required, a custom set of XPath expressions can also be used to import the patterns data.
Examples
With the Databinding Patterns loaded in SketchPath and saved for reuse as a SketchPath library file, this tool can also be used offline. The first step in using SketchPath as a patterns detector, is to load an XSD instance document that requires checking against the patterns. The W3C Databinding Working Group has provided a large number of example files to get you started.
Using SketchPath Modes
On opening an XML file in SketchPath all the current XPath expressions that are 'in scope' are re-evaluated and the result values are shown in a grid. Scope is selected simply by selecting a group or 'all groups' from a dropdown list (or by selecting the group cell in the Manager Pane).
To navigate through the XSD by looking at each pattern 'hit' in turn, its simply a question of selecting the named pattern in the 'Variables Pane'. In 'Results' mode, if the return sequence comprises a number of nodes, then only the first node is highlighted and the results list remains unchanged. In 'Browser' mode, selecting a named pattern results in all the hits being listed in the results list and the element node hits are highlighted by 'bookmark' icons in the element tree-view.
The 'Manager' and 'Reviewer' modes are similar, but this time the results pane is hidden in preference to the Expression Manager pane which allows a fuller view of all the columns in the expression library and also provides for an additional toolbar dedicated to moving expressions around or deleting them.
Importing and saving the W3C Databinding Patterns (SketchPath 2.0.0.2)
1. Check XPath 2.0 (Basic) is selected on the XPath toolbar dropdown menu
2. On the SketchPath Menu Bar (see screenshot - left), click:
Library > Import W3C Databinding Patterns
3. Open the XML document that you wish to detect patterns in and switch mode from 'Results to 'Browser' on the dropdown menu
4. Click 'Save XPath File' on the XPath Expression toolbar. These saved expressions can now be reloaded when required, or each time SketchPath is launched if a shortcut is created with the correct commandline arguments.
SketchPath Downloads Page
XSD Databinding Patterns is a W3C Specification

