Re: [PHP-XML-DEV] Validating XML

[email protected] (%u) 16 Jun 2004 02:42:46 -0000
Newsgroups php.xml.dev
Message-ID <[email protected]>
Hi People,

Hoping someone can give a further heads up on the PHP5 DOM methods.

I am running PHP5 (PHP Version 5.0.0RC3) and trying to use the schemaValidateSource method if the XML file is valid against the schema all is good however as soon as I make a change to the schema file (as part of a test) I get the following warning show in the browser:

Warning: Element comment: failed to validate basic type date in c:\program files\apache group\Apache\htdocs\xmlimporter\importerfactory.php on line 21

This is causing me some distress as it is a completely unexpected warning that kicks out of my function with no return value.

here are the pertinent pieces of code:

    $schemaFileContents = file_get_contents('./XMLFiles/po.xsd');
    if ($testing->validateData('./XMLFiles/po.xsd')){

    // fuction from an object
    function validateData($schemaFile){
    	return $this->dom->schemaValidate($schemaFile);
    }

all this works fine if the xml is valid but if I make the following change it warnings as above

    //original working code from xsd
    <xsd:element name="comment" type="xsd:string"/>

    //code which makes xml invalid
    <xsd:element name="comment" type="xsd:date"/>

Any ideas are appreciated.

Eamon