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 '<b>DOMDocument::schemaValidate() Generated Errors!</b>';
   libxml_display_errors();   
}
?>
 /// fonctions.php ///
<?

function libxml_display_error($error)

{

   $return = "<br/>\n";

   switch ($error->level) {

       case LIBXML_ERR_WARNING:

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

           break;

       case LIBXML_ERR_ERROR:

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

           break;

       case LIBXML_ERR_FATAL:

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

           break;

   }

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

   if ($error->file) {

       $return .=    " in <b>$error->file</b>";

   }

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



   return $return;

}



function libxml_display_errors() {

   $errors = libxml_get_errors();

   foreach ($errors as $error) {

       print libxml_display_error($error);

   }

   libxml_clear_errors();

}

?>

Reply via email to