Type System
The type system of XPath 2.0 is noteworthy for the fact that it mixes strong typing and weak typing within a single language.
Operations such as arithmetic and boolean comparison require atomic values as their operands. If an operand returns a node (for example, @price * 1.2
), then the node is automatically atomized to extract the atomic value. If the input document has been validated against a schema, then the node will typically have a type annotation, and this determines the type of the resulting atomic value (in this example, the price
attribute might have the type decimal
). If no schema is in use, the node will be untyped, and the type of the resulting atomic value will be untypedAtomic
. Typed atomic values are checked to ensure that they have an appropriate type for the context where they are used: for example, it is not possible to multiply a date by a number. Untyped atomic values, by contrast, follow a weak typing discipline: they are automatically converted to a type appropriate to the operation where they are used: for example with an arithmetic operation an untyped atomic value is converted to the type double
.
Read more about this topic: XPath 2.0
Famous quotes containing the words type and/or system:
“We have two kinds of conference. One is that to which the office boy refers when he tells the applicant for a job that Mr. Blevitch is in conference. This means that Mr. Blevitch is in good health and reading the paper, but otherwise unoccupied. The other type of conference is bona fide in so far as it implies that three or four men are talking together in one room, and dont want to be disturbed.”
—Robert Benchley (18891945)
“The dominant metaphor of conceptual relativism, that of differing points of view, seems to betray an underlying paradox. Different points of view make sense, but only if there is a common co-ordinate system on which to plot them; yet the existence of a common system belies the claim of dramatic incomparability.”
—Donald Davidson (b. 1917)