LibXML supports DTD, Schema and RelaxNG validation, during parsing, and post parsing.

Parse & Validate

<?php
$dom 
= new domDocument;
$dom->validateOnParse true;
$dom->load('note-invalid.xml');
?>
Parse Then Validate

<?php
$dom 
= new domDocument;
$dom->load('note.xml');
if (!
$dom->validate('note.dtd')) {
  print 
"Document note.dtd is not valid\n";
} else {
  print 
"Document note.dtd is valid\n";
}
?>