1. Go to this page and download the library: Download mihas2/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/ */
mihas2 / xml_validator example snippets
use mihas2\XmlValidator\XmlValidator;
$xmlFile = 'path/to/your/xml/file.xml';
$xmlFileValidator = new XmlValidator($xmlFile);
if ($xmlFileValidator->validate()) {
echo "XML file is valid.";
} else {
foreach ($xmlFileValidator->getErrors() as $error) {
printf("Line: %d, Column: %d, Message: %s\n", $error->lineNumber, $error->columnNumber, $error->message);
}
}
use mihas2\XmlValidator\XmlValidator;
$xmlUrl = 'https://www.yourdomain.com/validateme.xml';
$xmlUrlValidator = new XmlValidator($xmlUrl);
if ($xmlUrlValidator->validate()) {
echo "XML file is valid.";
} else {
foreach ($xmlUrlValidator->getErrors() as $error) {
printf("Line: %d, Column: %d, Message: %s\n", $error->lineNumber, $error->columnNumber, $error->message);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.