Validation
Programmatically validate an XML document
xquery version "3.0" encoding "UTF-8";
let $schema := doc('/db/apps/demo/examples/basic/DemoValidation.xsd')
let $xml-valid := doc('/db/apps/demo/examples/basic/DemoValidation-Valid.xml')
let $xml-invalid := doc('/db/apps/demo/examples/basic/DemoValidation-Invalid.xml')
return
<DemoValidation timestamp="{current-dateTime()}" schema="{document-uri($schema)}">
<Validate uri="{document-uri($xml-valid)}">
{
validation:validate-report($xml-valid, $schema)
}
</Validate>
<Validate uri="{document-uri($xml-invalid)}">
{
validation:validate-report($xml-invalid, $schema)
}
</Validate>
</DemoValidation>