XPath 2.0 - Type System

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:

    Histories of the world omitted China; if a Chinaman invented compass or movable type or gunpowder we promptly “forgot it” and named their European inventors. In short, we regarded China as a sort of different and quite inconsequential planet.
    —W.E.B. (William Edward Burghardt)

    We recognize caste in dogs because we rank ourselves by the familiar dog system, a ladderlike social arrangement wherein one individual outranks all others, the next outranks all but the first, and so on down the hierarchy. But the cat system is more like a wheel, with a high-ranking cat at the hub and the others arranged around the rim, all reluctantly acknowledging the superiority of the despot but not necessarily measuring themselves against one another.
    —Elizabeth Marshall Thomas. “Strong and Sensitive Cats,” Atlantic Monthly (July 1994)