Invalid Schema using schemaValidate of PHP
<p>I'm trying to validate xml files against a specific XSD with PHP. Tests have been done on Windows 7 with EasyPHP-12.1 (PHP 5.4.6 edition). Here is the server side PHP file which loads an xml, validates it and displays any errors.</p>

<p><strong>PHP code</strong></p>

<pre><code>function libxml_display_error($error)
{
    $return = "&lt;br/&gt;\n";
    switch ($error-&gt;level) {
        case LIBXML_ERR_WARNING:
            $return .= "&lt;b&gt;Warning $error-&gt;code&lt;/b&gt;: ";
            break;
        case LIBXML_ERR_ERROR:
            $return .= "&lt;b&gt;Error $error-&gt;code&lt;/b&gt;: ";
            break;
        case LIBXML_ERR_FATAL:
            $return .= "&lt;b&gt;Fatal Error $error-&gt;code&lt;/b&gt;: ";
            break;
    }
    $return .= trim($error-&gt;message);
    if ($error-&gt;file) {
        $return .=    " in &lt;b&gt;$error-&gt;file&lt;/b&gt;";
    }
    $return .= " on line &lt;b&gt;$error-&gt;line&lt;/b&gt;\n";

    return $return;
}

function libxml_display_errors() {
    $errors = libxml_get_errors();
    foreach ($errors as $error) {
        print libxml_display_error($error);
    }
    libxml_clear_errors();
}

// Enable error handling
libxml_use_internal_errors(true);

$xml = new DOMDocument();
$xml-&gt;load('testFile');
if (!$xml-&gt;schemaValidate('sampleSchema.xsd')) {
    print '&lt;b&gt;Errors Found!&lt;/b&gt;';
    libxml_display_errors();
}
else {
echo "Validated Successfully!";
}
</code></pre>

<p>Using the below xml and xsd schema it works successfully without generating any errors:</p>

<p><strong>XML:</strong>
    <pre> <code>&lt;lures>
     &lt;lure>
      &lt;lureName>Silver Spoon&lt;/lureName>
      &lt;lureCompany>Clark&lt;/lureCompany>
      &lt;lureQuantity>7&lt;/lureQuantity>
     &lt;/lure>
    &lt;/lures>
    </code> </pre></p></p>

<p><strong>XSD:</strong>
    <pre> <code>&lt;?xml version="1.0"?>
    &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    &lt;xs:element name="lures">
     &lt;xs:complexType> 
      &lt;xs:sequence>
       &lt;xs:element name="lure">
        &lt;xs:complexType>
         &lt;xs:sequence>
         &lt;xs:element name="lureName" type="xs:string"/>
         &lt;xs:element name="lureCompany" type="xs:string"/>
         &lt;xs:element name="lureQuantity" type="xs:integer"/>
         &lt;/xs:sequence>
        &lt;/xs:complexType>
       &lt;/xs:element>
      &lt;/xs:sequence>
     &lt;/xs:complexType>
    &lt;/xs:element>
    &lt;/xs:schema></code> </pre></p>

<p>However, the problem appears when i try to validate a Mpeg7 xml according to the standard Mpeg7 schema file <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-7_schema_files/mpeg7-v1.xsd" rel="nofollow">mpeg7-v1.xsd</a>, where PHP generates the following error:</p>

<pre><code>Warning: DOMDocument::schemaValidate(): Invalid Schema in C:\Program Files (x86)\EasyPHP-12.1\www\ServerSideTests\validate.php on line 38
Errors Found!
Error 3008: local list type: A type, derived by list or union, must have the simple ur-type definition as base type, not '{urn:mpeg:mpeg7:schema:2001}integerVector'. in file:///C:/Program%20Files%20(x86)/EasyPHP-12.1/www/ServerSideTests/mpeg7-v1.xsd on line 1251
</code></pre>

<p>I wonder how can be possible to be invalid the official XSD...since the XSD is perfectly correct, then maybe the libxml library is not fully compatible with this W3C Schema?
All i want to know is how i have to modify the above code for the succesfull validation of the mpeg7 files or if i have to implement it into another server side language...</p>

<p><strong>EDIT: My test Mpeg7 file</strong></p>

<pre><code>&lt;Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" 
       xmlns:xml="http://www.w3.org/XML/1998/namespace"
       xsi:schemaLocation="urn:mpeg:mpeg7:schema:2001  mpeg7-v1.xsd"&gt;
&lt;Description xsi:type="CompleteDescriptionType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;Relationships/&gt;
&lt;/Description&gt;
&lt;/Mpeg7&gt;
</code></pre>
