Changes

Jump to navigation Jump to search
1,329 bytes added ,  12:37, 17 September 2015
no edit summary
All errors are assigned to the <code><nowiki>http://basex.org/errors</nowiki></code> namespace, which is statically bound to the {{Code|bxerr}} prefix.
=FunctionsDTD Validation=
==Checks whether an XML document validates against a DTD==. The input document can be specified as:
=* an {{Code|xs:string}}, containing the path to the resource,* an {{Code|xs:string}}, containing the resource in its string representation, or* a {{Code|node()}}, containing the resource itself. If no DTD is supplied in a function, the XML document is expected to contain an embedded DTD doctype declaration. ==validate:dtd===
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|validate:dtd|$input as item()|empty-sequence()}}<br />{{Func|validate:dtd|$input as item(), $schema as xs:string?|empty-sequence()}}
|-
| '''Summary'''
|Validates the document specified by XML {{Code|$input}}. document against a {{Code|$inputschema}} can be specified as:* and returns an {{Code|xs:string}}, containing the path to the resource,* empty sequence or an {{Code|xs:string}}, containing the resource in its string representation, or* a {{Code|node()}}, containing the resource itself.{{Code|$schema}} can be used to specify the DTD for validation. If no DTD is given, {{Code|$input}} is required to contain a DTD doctype declarationerror.<br />
|-
| '''Errors'''
|{{Error|BXVA0001|#Errors}} the validation fails.<br/>{{Error|BXVA0002|#Errors}} the validation process cannot be started.<br/>{{Error|BXVA0003|#Errors}} no DTD Schema validator is available.
|-
| '''Examples'''
|}
===validate:dtd-info===
{| width='100%'
|-
| '''Summary'''
|Validates the XML {{Code|$input}} document against a document {{Code|$schema}} and returns warnings, errors and fatal errors in a string sequence. See [[#validate:dtd|validate:dtd]] for more details on the function arguments.
|-
| '''Errors'''
|{{Error|BXVA0002|#Errors}} the validation process cannot be started.<br/>{{Error|BXVA0003|#Errors}} no DTD Schema validator is available.
|-
| '''Examples'''
|}
===validate:dtd-report===
{{Mark|Introduced with Version 8.3}}:
|-
| '''Summary'''
|Validates the XML {{Code|$input}} document against a document {{Code|$schema}} and returns warnings, errors and fatal errors as XML. See [[#validate:dtd|validate:dtd]] for more details on the function arguments.
|-
| '''Errors'''
|{{Error|BXVA0002|#Errors}} the validation process cannot be started.<br/>{{Error|BXVA0003|#Errors}} no DTD Schema validator is available.
|-
| '''Examples'''
|}
=XML Schema Validation{{Mark|Updated with Version 8.3}}: Checks whether an XML document validates against an XML Schema. The input document and the schema can be specified as: * {{Code|xs:string}}, containing the path to the resource,* {{Code|xs:string}}, containing the resource in its string representation, or* {{Code|node()}}, containing the resource itself. If no schema is given, the input is expected to contain an {{Code|xsi:(noNamespace)schemaLocation}} attribute, as defined in [http://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation W3C XML Schema]. Different XML Schema==implementations can be applied for validation: * Java includes a default implementation of XML Schema (which is an older version of Apache Xerces)* If [https://xerces.apache.org/xerces2-j Xerces2] exists in the classpath, it will be used instead. If you want to manually add Xerces2, you should download the [http://xerces.apache.org/mirrors.cgi#binary Xerces2 Java ..... (XML Schema 1.1) (Beta)] archive and copy at least four libraries ({{Code|cupv10k-runtime.jar}}, {{Code|org.eclipse.wst.xml.xpath2.processor_1.1.0.jar}}, {{Code|xercesImpl.jar}}, {{Code|xml-apis.jar}}) to the {{Code|lib}} directory of the full distribution of BaseX.* The [http://www.saxonica.com/ Saxon] Enterprise Edition (saxon9ee.jar) is detected as well. With {{Version|8.3}}, the XML Schema version can be specified as well:
* The [http://www.saxonica.com/ Saxon XSLT Processor] – version must be {{Code|SaxonHE1.jar0}}, or {{Code|SaxonPE1.jar1}}, .* Version 1.1 is only available if Saxon EE or {{Code|SaxonEEXerces2 (beta version with XML Schema 1.jar}} – 1 support) is used if it available.* If Xerces2 is manually added to the classpath.,
===validate:xsd===
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|validate:xsd|$input as item()|empty-sequence()}}<br />{{Func|validate:xsd|$input as item(), $schema as item()?|empty-sequence()}}<br />{{Func|validate:xsd|$input as item(), $schema as item()?, $version as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Validates the document specified by XML {{Code|$input}}. Both {{Code|$input}} and document against a {{Code|$schema}} can be specified as:* {{Code|xs:string}}, containing the path to the resource,* {{Code|xs:string}}, containing the resource in its string representation, or* {{Code|node()}}, containing the resource itself.{{Code|$schema}} can be used to specify the schema for validation. If no schema is given, {{Code|$input}} is required to contain an {{Code|xsi:(noNamespace)schemaLocation}} attribute as defined in [http://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation W3C XML Schema].<br />
|-
| '''Errors'''
|}
===validate:xsd-info===
{| width='100%'
|}
===validate:xsd-report===
{{Mark|Introduced with Version 8.3}}:
|}
=RelaxNGChecks whether an XML document validates against a RelaxNG==schema. The input document and the schema an be specified as: * {{Code|xs:string}}, containing the path to the resource,* {{Code|xs:string}}, containing the resource in its string representation, or* {{Code|node()}}, containing the resource itself.
RelaxNG validation will be available if [http://www.thaiopensource.com/relaxng/jing.html Jing] exists in the classpath. The latest version, {{Code|jing-20091111.jar}}, is included in the full distributions of BaseX.
===validate:rng===
{{Mark|Introduced with Version 8.3}}:
|-
| '''Summary'''
|Validates the document specified by XML {{Code|$input}}. The validation schema is specified by document against a {{Code|$schema}}, and using the XML or {{Code|$compact}} indicates if the schema uses the compact RelaxNG notation. Both {{Code|$input}} and {{Code|$schema}} can be specified as:* {{Code|xs:string}}, containing the path to the resource,* {{Code|xs:string}}, containing the resource in its string representation, or* {{Code|node()}}, containing the resource itself.
|-
| '''Errors'''
|{{Error|BXVA0001|#Errors}} the validation fails.<br/>{{Error|BXVA0002|#Errors}} the validation process cannot be started.<br/>{{Error|BXVA0003|#Errors}} the RelaxNG validator is not available.<br/>{{Error|BXVA0004|#Errors}} no validator is found for the specified version.
|-
| '''Examples'''
|}
===validate:rng-info===
{{Mark|Introduced with Version 8.3}}:
|-
| '''Summary'''
|Validates the XML {{Code|$input}} document against a document {{Code|$schema}}, using the XML or {{Code|$compact}} notation, and returns warnings, errors and fatal errors in a string sequence. See [[#validate:rng|validate:rng]] for more details on the function arguments.
|-
| '''Errors'''
|{{Error|BXVA0002|#Errors}} the validation process cannot be started.<br/>{{Error|BXVA0003|#Errors}} the RelaxNG validator is not available.<br/>{{Error|BXVA0004|#Errors}} no validator is found for the specified version.
|}
===validate:rng-report===
{{Mark|Introduced with Version 8.3}}:
|-
| '''Summary'''
|Validates the XML {{Code|$input}} document against a document {{Code|$schema}}, using the XML or {{Code|$compact}} notation, and returns warnings, errors and fatal errors as XML. See [[#validate:rng|validate:rng]] for more details on the function arguments.
|-
| '''Errors'''
|{{Error|BXVA0002|#Errors}} the validation process cannot be started.<br/>{{Error|BXVA0003|#Errors}} The RelaxNG validator is not available.<br/>{{Error|BXVA0004|#Errors}} no validator is found for the specified version.
|}
|{{Code|BXVA0003}}
|No validator is available.
|-
|{{Code|BXVA0004}}
|No validator is found for the specified version.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu