Loading TOC...

sc.typeApply

sc.typeApply(
   $type as schemaType(),
   $arg as String
) as Sequence

Summary

Apply a type to an item to construct a typed instance of that type. If the type is a simple type this amounts to casting. If the type is a complex type this amounts to validating as that type.

Parameters
$type The type to apply.
$arg The item to apply the type to.

Example

sc.typeApply( sc.typeNamed(xs.QName('xs:integer')), "47" );
  => 47

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.