I have figured out how to validate an XML file using an XSD schema in PHP using this code, but it appears the processing is done using XSD version 1.0.
$dom = new DOMDocument();
$dom->loadXML($xmlString);
$isValid = $dom->schemaValidate($xsdFile);
For my case, I need the XSD file to be treated as version 1.1. The main reason for this is that I want to use:
<xs:all>
<xs:element type="xs:string" name="br" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="linkType" name="link" minOccurs="0" maxOccurs="unbounded"/>
</xs:all>
Notice the maxOccurs="unbounded" which can only be used inside <xs:all> with version 1.1. In version 1.0, the maxOccurs can only be 0 or 1.
PHP fails with the generic error:
Warning: DOMDocument::schemaValidate(): Invalid Schema
DOMDocument::schemaValidate use Libxml. Libxml does not support XSD 1.1.