#46465 [NoF->Fbk]: libxml expects DTD declaration while validating XML against RelaxNG or XSD

From: Date: Wed, 11 Feb 2009 21:22:01 +0000
Subject: #46465 [NoF->Fbk]: libxml expects DTD declaration while validating XML against RelaxNG or XSD
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133732@lists.php.net to get a copy of this message
 ID:               46465
 Updated by:       felipe@php.net
 Reported By:      faw217 at gmail dot com
-Status:           No Feedback
+Status:           Feedback
 Bug Type:         XML related
 Operating System: GNU/Linux
 PHP Version:      5.3.0alpha2
 New Comment:

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 <?php and ends 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.




Previous Comments:
------------------------------------------------------------------------

[2008-11-11 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2008-11-03 08:38:05] jani@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 <?php and ends 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.



------------------------------------------------------------------------

[2008-11-02 17:55:16] faw217 at gmail dot com

Description:
------------
I experienced it using XMLReader, I don't know if it affects other
tools too:

Even if I set XMLReader to validate XML document against RelaxNG or XSD
schema, then libxml_get_errors() will obtain an error:
Validation failed: no DTD found!

Reproduce code:
---------------
libxml_use_internal_errors(true);

$XMLReader = new XMLReader;
$XMLReader->open('./path/to/file.xml');
$XMLReader->setRelaxNGSchema('./path/to/schema');
$XMLReader->setParserProperty(XMLReader::VALIDATE, true);

do
{
	$element = @XMLReader->read();
} while ($element);

var_dump(libxml_get_errors());

Expected result:
----------------
array(0) {
}

Actual result:
--------------
array(1) {
  [0]=>
  object(LibXMLError)#2 (6) {
    ["level"]=>
    int(X)
    ["code"]=>
    int(X)
    ["column"]=>
    int(X)
    ["message"]=>
    string(33) "Validation failed: no DTD found !"
    ["file"]=>
    string(X) "./path/to/file.xml"
    ["line"]=>
    int(X)
  }
}


------------------------------------------------------------------------


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



Thread (3 messages)

« previous php.bugs (#133732) next »