Validating an XML document : DomDocument « XML « PHP
- PHP
- XML
- DomDocument
Validating an XML document
<?
$file = 'address-book.xml';
$schema = 'address-book.xsd';
$ab = new DOMDocument;
$ab->load($file);
if ($ab->schemaValidate($schema)) {
print "$file is valid.\n";
} else {
print "$file is invalid.\n";
}
?>
Related examples in the same category