Open In App

PHP | DOMDocument schemaValidate() Function

The DOMDocument::schemaValidate() function is an inbuilt function in PHP which is used to validate a document based on the given schema file. The schema file can be in an XSD format which is the recommendation from W3C (World Wide Web Consortium).

Syntax:



bool DOMDocument::schemaValidate( string $filename, int $flags = 0 )

Parameters: This function accept two parameters as mentioned above and described below:

Return Value: This function returns TRUE on success or False on failure.



Below given programs illustrate the DOMDocument::schemaValidate() function in PHP:

Program 1:

Program 2:

Reference: https://www.php.net/manual/en/domdocument.schemavalidate.php


Article Tags :