PHP | XMLReader setSchema() Function
Last Updated :
18 Mar, 2020
The XMLReader::setSchema() function is an inbuilt function in PHP which is used to validate the document using a XSD schema. This XSD schema is nothing but a file that defines the rule for the XML structure and should be in the form of .xsd file.
Syntax:
bool XMLReader::setSchema( string $filename )
Parameters: This function accepts a single parameter $filename which holds the XSD filename.
Return Value: This function returns TRUE on success or FALSE on failure.
Exceptions: This function throws E_WARNING if libxml extension was compiled without schema support.
Below examples illustrate the XMLReader::setSchema() function in PHP:
Example 1:
Example 2:
Reference: https://www.php.net/manual/en/xmlreader.setschema.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...