Re: [PHP] Bug in DOMDocument schemaValidate() function?

2012-05-14 Thread Voß , Marko
Hello,

I am sorry, but everything is ok here. I am performing an unmarshalling and 
marshalling unit test for every resource and 
the problem was, that after unmarshalling to the object, the marshalling of the 
object did not create the version 
element. I did not notice this in the first place.

So the validation error occured after the step of testing the marshalling and 
not before testing the unmarshalling.

Thank you anyways!

Best regards,
Marko

Am 14.05.2012 16:43, schrieb Matijn Woudt:
> On Mon, May 14, 2012 at 1:39 PM, Voß, Marko  
> wrote:
>> Hello,
>>
>> I am validating user DOM against schema files using the following piece of 
>> code:
>>
>> $valid = @$doc->schemaValidate($xsdFile);
>>
>> where $doc is of type DOMDocument and $xsdFile is the file location of the 
>> XSD file.
>>
>> Everything worked fine until the following validation occured:
>>
>> A validation of a XML against the SRW/U schema 
>> (http://www.loc.gov/standards/sru/sru1-1archive/xml-files/srw-types.xsd)
>> failed.
>>
>> Here is the XML:
>>
>> -
>> 
>> http://www.loc.gov/zing/srw/"; 
>> xmlns:zr="http://explain.z3950.org/dtd/2.0/";>
>>1.1
>>
>>  http://explain.z3950.org/dtd/2.0/
>>  XML
>>  
>>
>>  http://myserver.com/db"; protocol="SRU" 
>> version="1.1">
>>myserver.com
>>80
>>sru
>>  
>>  
>>SRU Test Database
>>  My server SRU Test 
>> Database
>>  
>>  
>>27-11-2003
>>  
>>
>>  
>>
>> 
>> -
>>
>> This XML is valid. However, I keep getting the following libxml error:
>>
>> object(LibXMLError)#192 (6) {
>>  ["level"]=>
>>  int(2)
>>  ["code"]=>
>>  int(1871)
>>  ["column"]=>
>>  int(0)
>>  ["message"]=>
>>  string(133) "Element '{http://www.loc.gov/zing/srw/}record': This 
>> element is not expected. Expected is (
>> {http://www.loc.gov/zing/srw/}version ).
>> "
>>  ["file"]=>
>>  string(0) ""
>>  ["line"]=>
>>  int(0)
>> }
>>
>> I think, the validator is unable to handle the xsd:extension part of the 
>> schema:
>>
>> 
>>
>>  
>>
>>  
>>  
>>  
>>
>>  
>>
>> 
>>
>> The version-element exists and is at the right place. If I add another 
>> version-element after the first one, it complains
>> about expecting a record-element instead, which is correct. But it is not 
>> correct to expect another version-element
>> after the already existing one.
>>
>> Is this a bug? Or did I made a mistake somewhere and I am not able to see it 
>> right now?
>>
>>
>> Thank you for any help!
>>
>> Best regards,
>> Marko
>>
>
> If you're 100% sure this XML is valid, then this is a bug. You should
> report it at bugs.php.net, but it is most likely this bug is in
> libXML, and needs to be fixed there.
>
> - Matijn


---

Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische 
Information mbH. 
Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 
101892. 
Geschäftsführerin: Sabine Brünger-Weilandt. 
Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.



Re: [PHP] Bug in DOMDocument schemaValidate() function?

2012-05-14 Thread Matijn Woudt
On Mon, May 14, 2012 at 1:39 PM, Voß, Marko  wrote:
> Hello,
>
> I am validating user DOM against schema files using the following piece of 
> code:
>
> $valid = @$doc->schemaValidate($xsdFile);
>
> where $doc is of type DOMDocument and $xsdFile is the file location of the 
> XSD file.
>
> Everything worked fine until the following validation occured:
>
> A validation of a XML against the SRW/U schema 
> (http://www.loc.gov/standards/sru/sru1-1archive/xml-files/srw-types.xsd)
> failed.
>
> Here is the XML:
>
> -
> 
> http://www.loc.gov/zing/srw/"; 
> xmlns:zr="http://explain.z3950.org/dtd/2.0/";>
>   1.1
>   
>     http://explain.z3950.org/dtd/2.0/
>     XML
>     
>       
>         http://myserver.com/db"; protocol="SRU" 
> version="1.1">
>           myserver.com
>           80
>           sru
>         
>         
>           SRU Test Database
>            My server SRU Test 
> Database
>         
>         
>           27-11-2003
>         
>       
>     
>   
> 
> -
>
> This XML is valid. However, I keep getting the following libxml error:
>
> object(LibXMLError)#192 (6) {
>     ["level"]=>
>     int(2)
>     ["code"]=>
>     int(1871)
>     ["column"]=>
>     int(0)
>     ["message"]=>
>     string(133) "Element '{http://www.loc.gov/zing/srw/}record': This element 
> is not expected. Expected is (
> {http://www.loc.gov/zing/srw/}version ).
> "
>     ["file"]=>
>     string(0) ""
>     ["line"]=>
>     int(0)
> }
>
> I think, the validator is unable to handle the xsd:extension part of the 
> schema:
>
> 
>   
>     
>       
>         
>         
>         
>       
>     
>   
> 
>
> The version-element exists and is at the right place. If I add another 
> version-element after the first one, it complains
> about expecting a record-element instead, which is correct. But it is not 
> correct to expect another version-element
> after the already existing one.
>
> Is this a bug? Or did I made a mistake somewhere and I am not able to see it 
> right now?
>
>
> Thank you for any help!
>
> Best regards,
> Marko
>

If you're 100% sure this XML is valid, then this is a bug. You should
report it at bugs.php.net, but it is most likely this bug is in
libXML, and needs to be fixed there.

- Matijn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Bug in DOMDocument schemaValidate() function?

2012-05-14 Thread Voß , Marko
Hello,

I am validating user DOM against schema files using the following piece of code:

$valid = @$doc->schemaValidate($xsdFile);

where $doc is of type DOMDocument and $xsdFile is the file location of the XSD 
file.

Everything worked fine until the following validation occured:

A validation of a XML against the SRW/U schema 
(http://www.loc.gov/standards/sru/sru1-1archive/xml-files/srw-types.xsd) 
failed.

Here is the XML:

-

http://www.loc.gov/zing/srw/"; 
xmlns:zr="http://explain.z3950.org/dtd/2.0/";>
   1.1
   
 http://explain.z3950.org/dtd/2.0/
 XML
 
   
 http://myserver.com/db"; protocol="SRU" 
version="1.1">
   myserver.com
   80
   sru
 
 
   SRU Test Database
My server SRU Test 
Database
 
 
   27-11-2003
 
   
 
   

-

This XML is valid. However, I keep getting the following libxml error:

object(LibXMLError)#192 (6) {
 ["level"]=>
 int(2)
 ["code"]=>
 int(1871)
 ["column"]=>
 int(0)
 ["message"]=>
 string(133) "Element '{http://www.loc.gov/zing/srw/}record': This element 
is not expected. Expected is ( 
{http://www.loc.gov/zing/srw/}version ).
"
 ["file"]=>
 string(0) ""
 ["line"]=>
 int(0)
}

I think, the validator is unable to handle the xsd:extension part of the schema:


   
 
   
 
 
 
   
 
   


The version-element exists and is at the right place. If I add another 
version-element after the first one, it complains 
about expecting a record-element instead, which is correct. But it is not 
correct to expect another version-element 
after the already existing one.

Is this a bug? Or did I made a mistake somewhere and I am not able to see it 
right now?


Thank you for any help!

Best regards,
Marko


---

Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische 
Information mbH. 
Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 
101892. 
Geschäftsführerin: Sabine Brünger-Weilandt. 
Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php