#50201 [NEW]: Error validating xml with namespace against xsd

2009-11-17 Thread a dot testa at wifisolution dot it
From: a dot testa at wifisolution dot it
Operating system: linux
PHP version:  5.2.11
PHP Bug Type: DOM XML related
Bug description:  Error validating xml with namespace against xsd

Description:

php fails to validate a xml against a xsd.
the xml is build with the DOM interface.
the function schemaValidate returns true if i load the document from a
file but not with the same document created on the fly.

as workaround i can create the document, write it on a file, load againt
and then validate.


-- 
Edit bug report at http://bugs.php.net/?id=50201&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50201&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50201&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50201&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50201&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50201&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50201&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=50201&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=50201&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=50201&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=50201&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=50201&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=50201&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=50201&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50201&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=50201&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=50201&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=50201&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=50201&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=50201&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=50201&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=50201&r=mysqlcfg



#50201 [Fbk->Opn]: Error validating xml with namespace against xsd

2009-11-17 Thread a dot testa at wifisolution dot it
 ID:   50201
 User updated by:  a dot testa at wifisolution dot it
 Reported By:  a dot testa at wifisolution dot it
-Status:   Feedback
+Status:   Open
 Bug Type: DOM XML related
 Operating System: linux
 PHP Version:  5.2.11
 New Comment:

here sample code that can reproduce the problem

class DOMDocument_NIC extends DOMDocument{   
public function isValid_onfile(){
$tempFile = time() . '-' . rand() . '-xmlvalidation.tmp';
$this->save($tempFile);
 
// Create temporary DOMDocument_NIC and re-load content from
file.
$tempDom = new DOMDocument();
$tempDom->load($tempFile);
 
// Delete temporary file.
if (is_file($tempFile)){
unlink($tempFile);
}
return
$tempDom->schemaValidate('hosting_epp_nic_it/epp-1.0.xsd');
}
public function isValid_onfly(){
return
$this->schemaValidate('hosting_epp_nic_it/epp-1.0.xsd');
}
}


$doc = new DOMDocument_NIC('1.0', 'UTF-8');
$doc->xmlStandalone='no';
$xml_epp =
$doc->createElementNS("urn:ietf:params:xml:ns:epp-1.0",'epp');
$doc->appendChild($xml_epp);
$xml_epp->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:xsi',

'http://www.w3.org/2001/XMLSchema-instance');
$xml_epp->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance' 
,'xsi:schemaLocation', 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd');  

$xml_command = $doc->createElement('command');
$xml_epp->appendChild($xml_command);
$xml_login = $doc->createElement('logout');
$xml_command->appendChild($xml_login);
$xml_cltrid = $doc->createElement('clTRID',"123456");
$xml_command->appendChild($xml_cltrid);

//$response = new DOMDocument_NIC();
//$response->loadXML($xml);
echo htmlentities($doc->saveXML())."";
echo "Valido on File: ".$doc->isValid_onfile();
echo "Valido on Fly: ".$doc->isValid_onfly();


Previous Comments:


[2009-11-17 10:11:27] rricha...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2009-11-17 09:48:59] a dot testa at wifisolution dot it

Description:

php fails to validate a xml against a xsd.
the xml is build with the DOM interface.
the function schemaValidate returns true if i load the document from a
file but not with the same document created on the fly.

as workaround i can create the document, write it on a file, load
againt and then validate.






-- 
Edit this bug report at http://bugs.php.net/?id=50201&edit=1