XML Navigation
Operator
- slash:
/ - descendant axis :
// - attribute axis:
@attr-name - atomization:
data(...) - filter:
[], e.g.@code[data(.)="CH"] - parent abbreviation:
/.. - collections:
collection(...)
Use.to represent the current element
JSON Navigation
- using
.as the slash in XML. .countriesis different from.countries[]- using
$$to represent the current element.
Construction
- String Escaping
- JSONiq: using the backslash:
\",\nto replace quote, spare space. - XQuery: using
"$#x000a;…
- JSONiq: using the backslash:
- Booleans
- JSONiq:
true, false - XQuery:
true(), false()
- JSONiq:
Basic Operations
- Atomization: XML only:
<a>42</a>+1=42+1=43 - Empty sequence:
()+1=() - Cardinality:
(3,4)+2: error - General Comparison: =,<,>,>=,<=, but all the types must be the same
- Value Comparison: le,lt,eq, ne, ge, gt
- logics: conjunction, disjunction, not
- non-booleans
- Parsing: from query to abstract syntax tree
- translating: from AST to Expression tree
- Optimization: Expression Tree
- Code Generation: from Expression Tree to Iterator Tree
Further Reading
XQuery, 2nd Edition Chapter 2, 3, 4, 6, 7, 10, 11,