看看
PHP’s DOM,特别是
DOMDocument::schemaValidate和
DOMDocument::validate.
原文链接:https://www.f2er.com/php/132685.htmlDOMDocument :: validate的例子相当简单:
<?PHP $dom = new DOMDocument; $dom->Load('book.xml'); if ($dom->validate()) { echo "This document is valid!\n"; } ?>