Paths

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:52

Query expressions can use all the standard XPath node selectors:

element names – e.g. ‘gn4:story’, ‘nav:referencing’;

attribute names – e.g. ‘@name’, ‘@nav:mimeExt’;

all nodes – ‘node()’;

text nodes –  ‘text()’;

root node – ‘/’;

current node– ‘.’;

the ‘*’ wild-card – either for the entire name (e.g. ‘gn4:story/*’ – all sub-elements of ‘gn4:story’) or just the local name (e.g. ‘gn4:story/nav:*’ – all sub-elements of ‘gn4:story’ with a name in the ‘nav’ namespace).

In particular the ‘*’ wild-card can be used to create queries across multiple object types, for example

 gn4:*[@pixWidth>0]

returns all objects that have a ‘pixWidth’ attribute greater than 0; when using the standard Tark4 schema these will be images and videos with a pixel width greater than 0.

As already seen node selectors can be concatenated with ‘/’ or restricted with a condition within brackets. They can also be combined with the union operator ‘|’ – e.g.

 (gn4:image|gn4:img)[@pixHeight>1000]

returns all the images and editorial images (‘img’) with a pixel height greater than 1000.

The ‘//’ XPath operator and the XPath axes ‘ancestor’, ‘ancestor-or-self’, ‘descendant’, ‘descendant-or-self’, ‘following’, ‘following-sibling’, ‘namespace’, ‘preceding’ and ‘preceding-sibling’ are NOT supported.