xml spy
Previous  Top  Next

Type conversion checking


From MapForce 2006 SP2 on, the generated applications and preview (with the builtin execution engine) check for type-conversion errors in more detail, inline with XSLT2 and XQUERY.

 

Converting values from one type to another may now result in a runtime-error, where in prior versions of MapForce would have produced some type of result.

 

Example: conversion of a xs:string 'Hello', to xs:decimal

 

MapForce 2006 Versions up to, and including SP1:

 

XSLT:

'Hello' (or 'NaN' when passed to a function dealing with number)

XSLT2:

error: "invalid lexical value"

Xquery:

error: "invalid lexical value"

Preview with BUILTIN-engine:

0

C++ app:

0

C# app:

error: "values not convertable"

Java app:

error: "values not convertable"

 

MapForce 2006 SP2:

 

XSLT:

'Hello' (or 'NaN' when passed to a function dealing with number)

XSLT2:

error: "invalid lexical value"

Xquery:

error: "invalid lexical value"

Preview with BUILTIN-engine:

error: "string-value 'Hello' could not be converted to decimal"

C++ app:

error: "values not convertable"

C# app:

error: "values not convertable"

Java app:

error: "values not convertable"

 

If type-conversion-errors occur, check that the types have been handled correctly. E.g. use the lang:numeric() function, to check if the source-value may be converted into a number, and then an if-else component to pass a different value in case it  fails (e.g. a constant containing -1, on the value-false parameter).


Previous  Top  Next

© 2008 Altova