<slide title="Document Validation">
<blurb>
%LibXML% supports DTD, Schema and RelaxNG validation, during parsing,
and post parsing.
</blurb>
<list>
<bullet>boolean attribute DOMDocument->validateOnParse</bullet>
<bullet>boolean DOMDocument->validate(string filename)</bullet>
<bullet>boolean DOMDocument->schemaValidate(string filename)</bullet>
<bullet>boolean DOMDocument->relaxNGValidate(string filename)</bullet>
</list>
<example title="Parse &amp; Validate">
<![CDATA[<?php
$dom = new domDocument;
$dom->validateOnParse = true;
$dom->load('note-invalid.xml');
?>]]>
</example>
<example title="Parse Then Validate">
<![CDATA[<?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";
}
?>]]>
</example>
</slide>
