XML VALIDATE TEXT

This statement has the following parameters:

Parameter Description
DocumentPointer The name of a COBOL pointer data item that points to an XML document that is stored in memory as a text string.
DocumentLength The name of a COBOL numeric data item that contains the length of the XML document pointed to by DocumentPointer.
SchemaName/ModelFileName The name of the schema file or set of model files that will be used to validate the XML document specified in DocumentPointer.

Description

The XML VALIDATE TEXT statement tests the XML document specified by the DocumentPointer and DocumentLength parameters to see if it is well-formed and valid.

A well-formed XML document is one that conforms to XML syntax rules. A valid XML document is one that is both well-formed and has content that conforms to rules specified by an XML schema file. The schema file is supplied by the user.

Note: On UNIX systems, the underlying XML parser, libxml, does not support schema validation. The XML VALIDATE TEXT statement on UNIX systems does not validate the XML document but does verify that it is well-formed.

A status value is returned in the XML-data-group data item, which is defined in the copybook, lixmldef.cpy.

Note: In the Windows implementation of XML Extensions, the Microsoft XML parser 4.0 ignores the document type definition (DTD) when validating an XML document against a schema file. Thus, any entities declared in the DTD will not be defined and cannot be referenced. Any XML document that contains entity references, other than the predefined XML entities, must be transformed with an XSLT stylesheet prior to validation against a schema file when using the Microsoft XML parser 4.0 so that any non-predefined entity references are removed. Otherwise, the document will fail validation.

Example

XML VALIDATE TEXT
    MY-DOCUMENT-POINTER
    MY-DOCUMENT-LENGTH
    "MY-SCHEMA".
IF NOT XML-OK GO TO Z.