<p>Is there a way (without installing any libraries) of validating XML using a custom DTD in PHP?</p>

Take a look at
PHP's DOM
, especially
DOMDocument::schemaValidate
and
DOMDocument::validate
.
The example for DOMDocument::validate is fairly simple:
```
```
<?php
$dom = new DOMDocument;
$dom->Load('book.xml');
if ($dom->validate()) {
    echo "This document is valid!\n";
}
?>
```
```