Changes

Jump to navigation Jump to search
174 bytes removed ,  16:17, 26 May 2012
no edit summary
=Conventions=
All functions in this module are assigned to the <code>{{Code|http://basex.org/modules/validate</code> }} namespace, which is statically bound to the <code>{{Code|validate</code> }} prefix.<br/>All errors are assigned to the <code>{{Code|http://basex.org/errors</code> }} namespace, which is statically bound to the <code>{{Code|bxerr</code> }} prefix.
=Functions=
|-
| width='90' | '''Signatures'''
|<code><b>{{Func|validate:xsd</b>(|$input as item()) as |empty-sequence()</code>}}<br /><code><b>{{Func|validate:xsd</b>(|$input as item(), $schema as item()) as |empty-sequence()</code>}}
|-
| '''Summary'''
|Validates the document specified by <code>{{Code|$input</code>}}.<br />Both <code>{{Code|$input</code> }} and <code>{{Code|$schema</code> }} may be * an <code>{{Code|xs:string</code>}}, containing the path to the resource,* an <code>{{Code|xs:string</code>}}, containing the resource in its string representation, or* a <code>{{Code|node()</code>}}, containing the resource itself.<code>{{Code|$schema</code> }} can be used to specify the schema for validation. If no schema is given, <code>{{Code|$input</code> }} is required to contain an <code>{{Code|xsi:(noNamespace)schemaLocation</code> }} as defined in [http://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation W3C XML Schema].<br />
|-
| '''Errors'''
|'''[[{{Error|BXVA0001|XQuery Errors#Functions Errors|BXVA0001]]''' is raised if }} the addressed document cannot be validated against the given schema.
|-
| '''Examples'''
|
* <code>{{Code|validate:xsd('doc.xml', 'doc.xsd')</code> }} validates the document {{Code|doc.xm}} against the specified schema {{Code|doc.xsd}}.
* The following example demonstrates how a document can be validated against a schema without resorting to local or remote URIs:
<pre class="brush:xquery">
|-
| width='90' | '''Signatures'''
|<code><b>{{Func|validate:dtd</b>(|$input as item()) as |empty-sequence()</code>}}<br /><code><b>{{Func|validate:dtd</b>(|$input as item(), $dtd as xs:string) as |empty-sequence()</code>}}
|-
| '''Summary'''
|Validates the document specified by <code>{{Code|$input</code>}}.<br /><code>{{Code|$input</code> }} may be * an <code>{{Code|xs:string</code>}}, containing the path to the resource,* an <code>{{Code|xs:string</code>}}, containing the resource in its string representation, or* a <code>{{Code|node()</code>}}, containing the resource itself.<code>{{Code|$schema</code> }} can be used to specify the DTD for validation. If no DTD is given, <code>{{Code|$input</code> }} is required to contain a DTD doctype declaration.<br />
|-
| '''Errors'''
|'''[[{{Error|BXVA0001|XQuery Errors#Functions Errors|BXVA0001]]''' is raised if }} the addressed document cannot be validated against the given DTD.
|-
|}
! width="95%"|Description
|-
|<code>{{Code|BXVA0001</code>}}
|A document cannot be validated against the specified DTD or XML Schema.
|}
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu