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:

    It took six weeks of debate in the Senate to get the Arms Embargo Law repealed—and we face other delays during the present session because most of the Members of the Congress are thinking in terms of next Autumn’s election. However, that is one of the prices that we who live in democracies have to pay. It is, however, worth paying, if all of us can avoid the type of government under which the unfortunate population of Germany and Russia must exist.
    Franklin D. Roosevelt (1882–1945)

    Nobody is glad in the gladness of another, and our system is one of war, of an injurious superiority. Every child of the Saxon race is educated to wish to be first. It is our system; and a man comes to measure his greatness by the regrets, envies, and hatreds of his competitors.
    Ralph Waldo Emerson (1803–1882)