DOMDocument::schemaValidate() -> libxml_get_errors()

DOMDocument::schemaValidate() -> libxml_get_errors()

am 05.04.2007 15:30:12 von canardwc

--_0405-1530-12-PART-BREAK
Content-Type: text/plain; charset=us-ascii

Hello all, (sorry for my bad english)

I've this script, it checks an XML file with an XSD file.
it reports errors in the XML with line number, but i've large XML file (up
to 560MB) and the line number
doesn't exceed 65535. for upper lines he return always 65535.

An idea ?

Thx in advance.

---HERE IS THE CODE---
include("fonctions.php");

$xsd_file = $_COOKIE['xsd_file'];
$xml_file = "xml/".basename($_COOKIE['xml_file']);


libxml_use_internal_errors(true);

$xml = new DOMDocument();
$xml->load($xml_file);

if (!$xml->schemaValidate($xsd_file)) {
print 'DOMDocument::schemaValidate() Generated Errors!';
libxml_display_errors();
}
?>
/// fonctions.php ///

function libxml_display_error($error)

{

$return = "
\n";

switch ($error->level) {

case LIBXML_ERR_WARNING:

$return .= "Warning $error->code: ";

break;

case LIBXML_ERR_ERROR:

$return .= "Error $error->code: ";

break;

case LIBXML_ERR_FATAL:

$return .= "Fatal Error $error->code: ";

break;

}

$return .= trim($error->message);

if ($error->file) {

$return .= " in $error->file";

}

$return .= " on line $error->line\n";



return $return;

}



function libxml_display_errors() {

$errors = libxml_get_errors();

foreach ($errors as $error) {

print libxml_display_error($error);

}

libxml_clear_errors();

}

?>

--_0405-1530-12-PART-BREAK--

Re: DOMDocument::schemaValidate() -> libxml_get_errors()

am 05.04.2007 15:56:40 von tijnema

On 4/5/07, S=E9bastien WENSKE wrote:
> Hello all, (sorry for my bad english)
>
> I've this script, it checks an XML file with an XSD file.
> it reports errors in the XML with line number, but i've large XML file (u=
p
> to 560MB) and the line number
> doesn't exceed 65535. for upper lines he return always 65535.
>
> An idea ?
>
> Thx in advance.
>

I don't really understand what you're saying, but i might be able to
help you if you post the output of the script you posted, and then
tell what the expected output is.

Tijnema

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

Re: DOMDocument::schemaValidate() -> libxml_get_errors()

am 05.04.2007 16:23:19 von Jean-Marc Guillermin

If the error occure after the line 65535, libxml_get_errors() returns 65535.

Maybe this can help you Sébastien :

Class: LibXMLError
Properties (Read-Only):
(int) level
(int) code
(int) column
(string) message
(string) file
(int) line


jm

----- Original Message -----
From: "Tijnema !"
To: "Sébastien WENSKE"
Cc:
Sent: Thursday, April 05, 2007 3:56 PM
Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()


On 4/5/07, Sébastien WENSKE wrote:
> Hello all, (sorry for my bad english)
>
> I've this script, it checks an XML file with an XSD file.
> it reports errors in the XML with line number, but i've large XML file (up
> to 560MB) and the line number
> doesn't exceed 65535. for upper lines he return always 65535.
>
> An idea ?
>
> Thx in advance.
>

I don't really understand what you're saying, but i might be able to
help you if you post the output of the script you posted, and then
tell what the expected output is.

Tijnema

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


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

Re: DOMDocument::schemaValidate() -> libxml_get_errors()

am 05.04.2007 22:21:17 von canardwc

------=_NextPart_000_004B_01C777D0.BAE1EDA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Yes it's exactly the error, see the output :

DOMDocument::schemaValidate() Generated Errors!
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 33326 <- =
that's right
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in =
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- =
that's wrong the real line number is upper
[...]


is it du to the integer ?? (16bits ??)....




----- Original Message -----=20
From: "JM Guillermin"
To: "Tijnema !" ; "S=E9bastien WENSKE" =

Cc:
Sent: Thursday, April 05, 2007 4:23 PM
Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()


> If the error occure after the line 65535, libxml_get_errors() returns =
65535.
>=20
> Maybe this can help you S=E9bastien :
>=20
> Class: LibXMLError
> Properties (Read-Only):
> (int) level
> (int) code
> (int) column
> (string) message
> (string) file
> (int) line
>=20
>=20
> jm
>=20
> ----- Original Message -----=20
> From: "Tijnema !"
> To: "S=E9bastien WENSKE"
> Cc:
> Sent: Thursday, April 05, 2007 3:56 PM
> Subject: Re: [PHP] DOMDocument::schemaValidate() -> =
libxml_get_errors()
>=20
>=20
> On 4/5/07, S=E9bastien WENSKE wrote:
>> Hello all, (sorry for my bad english)
>>
>> I've this script, it checks an XML file with an XSD file.
>> it reports errors in the XML with line number, but i've large XML =
file (up
>> to 560MB) and the line number
>> doesn't exceed 65535. for upper lines he return always 65535.
>>
>> An idea ?
>>
>> Thx in advance.
>>
>=20
> I don't really understand what you're saying, but i might be able to
> help you if you post the output of the script you posted, and then
> tell what the expected output is.
>=20
> Tijnema
>=20
> --=20
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
>=20
> --=20
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
>
------=_NextPart_000_004B_01C777D0.BAE1EDA0--

Re: DOMDocument::schemaValidate() -> libxml_get_errors()

am 05.04.2007 23:01:54 von Jean-Marc Guillermin

It seems to be something like that, maybe try to find additional
informations on the LibXMLError class.

good luck.
jm

----- Original Message -----
From: "Sébastien WENSKE"
To: "JM Guillermin" ; "Tijnema !"
Cc:
Sent: Thursday, April 05, 2007 10:21 PM
Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()


Yes it's exactly the error, see the output :

DOMDocument::schemaValidate() Generated Errors!
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 33326 <- that's
right
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
Error 1871: Element 'EcheanceRMC': This element is not expected. in
file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line 65535 <- that's
wrong the real line number is upper
[...]


is it du to the integer ?? (16bits ??)....




----- Original Message -----
From: "JM Guillermin"
To: "Tijnema !" ; "Sébastien WENSKE"

Cc:
Sent: Thursday, April 05, 2007 4:23 PM
Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()


> If the error occure after the line 65535, libxml_get_errors() returns
> 65535.
>
> Maybe this can help you Sébastien :
>
> Class: LibXMLError
> Properties (Read-Only):
> (int) level
> (int) code
> (int) column
> (string) message
> (string) file
> (int) line
>
>
> jm
>
> ----- Original Message -----
> From: "Tijnema !"
> To: "Sébastien WENSKE"
> Cc:
> Sent: Thursday, April 05, 2007 3:56 PM
> Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()
>
>
> On 4/5/07, Sébastien WENSKE wrote:
>> Hello all, (sorry for my bad english)
>>
>> I've this script, it checks an XML file with an XSD file.
>> it reports errors in the XML with line number, but i've large XML file
>> (up
>> to 560MB) and the line number
>> doesn't exceed 65535. for upper lines he return always 65535.
>>
>> An idea ?
>>
>> Thx in advance.
>>
>
> I don't really understand what you're saying, but i might be able to
> help you if you post the output of the script you posted, and then
> tell what the expected output is.
>
> Tijnema
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Re: DOMDocument::schemaValidate() -> libxml_get_errors()

am 06.04.2007 00:06:37 von tijnema

On 4/5/07, S=E9bastien WENSKE wrote:
>
> Yes it's exactly the error, see the output :
>
> DOMDocument::schemaValidate() Generated Errors!
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 33326 <- that's right
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> Error 1871: Element 'EcheanceRMC': This element is not expected. in
> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
> 65535 <- that's wrong the real line number is upper
> [...]
>
>
> is it du to the integer ?? (16bits ??)....
>
>

I don't think it has to do with integer, unless you're running in
16bit mode.. (PHP can't even run under 16bit i guess..). An integer
could a lot more. I think there are 2 options that make this error:
1) The libxml library itself doesn't support it.
2) The PHP bindings with the libxml don't support it.

In the first case you would need to contact the libxml authors, in the
second case, you might want to write a patch that fixes it :)

Tijnema
>
>
> ----- Original Message -----
> From: "JM Guillermin"
> To: "Tijnema !" ; "S=E9bastien WENSKE"
>
> Cc:
> Sent: Thursday, April 05, 2007 4:23 PM
> Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()
>
> > If the error occure after the line 65535, libxml_get_errors() returns
> 65535.
> >
> > Maybe this can help you S=E9bastien :
> >
> > Class: LibXMLError
> > Properties (Read-Only):
> > (int) level
> > (int) code
> > (int) column
> > (string) message
> > (string) file
> > (int) line
> >
> >
> > jm
> >
> > ----- Original Message -----
> > From: "Tijnema !"
> > To: "S=E9bastien WENSKE"
> > Cc:
> > Sent: Thursday, April 05, 2007 3:56 PM
> > Subject: Re: [PHP] DOMDocument::schemaValidate() -> libxml_get_errors()
> >
> >
> > On 4/5/07, S=E9bastien WENSKE wrote:
> >> Hello all, (sorry for my bad english)
> >>
> >> I've this script, it checks an XML file with an XSD file.
> >> it reports errors in the XML with line number, but i've large XML file
> (up
> >> to 560MB) and the line number
> >> doesn't exceed 65535. for upper lines he return always 65535.
> >>
> >> An idea ?
> >>
> >> Thx in advance.
> >>
> >
> > I don't really understand what you're saying, but i might be able to
> > help you if you post the output of the script you posted, and then
> > tell what the expected output is.
> >
> > Tijnema
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

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

Re: DOMDocument::schemaValidate() -> libxml_get_errors()

am 06.04.2007 12:47:35 von Rob Richards

Tijnema ! wrote:
> On 4/5/07, Sébastien WENSKE wrote:
>>
>> Yes it's exactly the error, see the output :
>>
>> DOMDocument::schemaValidate() Generated Errors!

>> Error 1871: Element 'EcheanceRMC': This element is not expected. in
>> file:///D%3A/wamp/www/XML%20Validator/xml/Edit4.xml on line
>> 65535 <- that's wrong the real line number is upper
>> [...]

....

> I don't think it has to do with integer, unless you're running in
> 16bit mode.. (PHP can't even run under 16bit i guess..). An integer
> could a lot more. I think there are 2 options that make this error:
> 1) The libxml library itself doesn't support it.
> 2) The PHP bindings with the libxml don't support it.
>
> In the first case you would need to contact the libxml authors, in the
> second case, you might want to write a patch that fixes it :)

It is due to the structure in libxml2 (the line number in this case is
defined as unsigned short). This has been brought up before and wont be
changing as it would break API/AB compatibility. There really is little
you can do here.

Rob

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