PHP code example of vdhicts / xml-validator

1. Go to this page and download the library: Download vdhicts/xml-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vdhicts / xml-validator example snippets


$validator = new Validator();

// Validate with a XSD schema
$result = $validator->validate('books.xml', 'books.xsd');

// Or validate without a XSD schema
$result = $validator->validate('books.xml');

// Retrieve any errors
if (!$result->isValid()) {
    $errors = $result->getErrors();
}

composer