http://jsound.io/modules/validate

View as XML or JSON.

JSound simple validator. This is a JSONiq implemenation of the JSound (the schema for JSON) validator.

Function Summary

jsd-valid ($ns as string, $name as string, $instance as json-item()) as boolean

Validates the $instance JSON item against the JSound type with name $name and namespace $ns, from the JSound schema definition $jsd.

jsd-valid ($jsd as object(), $name as string, $ns as string, $instance as item()) as boolean

Validates the $instance JSON item against the JSound type with name $name and namespace $ns, from the JSound schema definition $jsd.

Functions

jsd-valid#3

declare  %an:sequential function jsv:jsd-valid($ns as string, $name as string, $instance as json-item()) as boolean
Validates the $instance JSON item against the JSound type with name $name and namespace $ns, from the JSound schema definition $jsd.

Parameters

ns as string
the namespace of the expected type
name as string
the name of the expected type
instance as json-item()
the instance to be validated

Returns

boolean
true if the instance is valid, otherwise throws an error.

jsd-valid#4

declare  %an:sequential function jsv:jsd-valid($jsd as object(), $name as string, $ns as string, $instance as item()) as boolean
Validates the $instance JSON item against the JSound type with name $name and namespace $ns, from the JSound schema definition $jsd.

Parameters

jsd as object()
the JSound schema as a JSON object to be validated against
name as string
the name of the expected type
ns as string
the namespace of the expected type
instance as item()
the instance to be validated

Returns

boolean
true if the instance is valid, otherwise throws an error.