PHP xml_error_string() ফাংশন

সংজ্ঞা ও ব্যবহার

xml_error_string() ফাংশন এক্সএমএল পার্সারের ত্রুটির বর্ণনা পায়

গঠনশৈলী

xml_error_string(errorcode)
প্রমাণপত্র বর্ণনা
errorcode অপরিহার্য।নির্দিষ্ট করা হওয়া ত্রুটির কোড।এই ত্রুটির কোড xml_get_error_code() ফাংশনের ফলাফল

Description

Returns with errorcode Returns the text description string corresponding to the error code parameter, if there is no corresponding description, it returns false.

Example

<?php
// Invalid xml file
$xmlfile = 'test.xml';
$xmlparser = xml_parser_create();
// open a file and read data
$fp = fopen($xmlfile, 'r');
while ($xmldata = fread($fp, 4096)) 
  {
  // parse the data chunk
  if (!xml_parse($xmlparser,$xmldata,feof($fp))) 
    {
    die( print "ERROR: "
    . xml_error_string(xml_get_error_code($xmlparser))
    . "<br />"
    . "Line: "
    . xml_get_current_line_number($xmlparser)
    . "<br />"
    . "Column: "
    . xml_get_current_column_number($xmlparser)
    . "<br />");
    }
  }
xml_parser_free($xmlparser);
?>

Output:

ERROR: Mismatched tag
Line: 8
Column: 51