PHP xml_parser_free() Function

❮ PHP XML Parser Reference

Example

Create an XML parser, parse an XML document (note.xml), then free the XML parser:

<?php
// Create an XML parser
$parser=xml_parser_create();

function char($parser,$data) {
echo $data;
}

xml_set_character_data_handler($parser,"char");
$fp=fopen("note.xml","r");

while ($data=fread($fp,4096)) {
  // Parse XML data
  xml_parse($parser,$data,feof($fp)) or
  die (sprintf("XML Error: %s at line %d",
  xml_error_string(xml_get_error_code($parser)),
  xml_get_current_line_number($parser)));
}

// Free XML parser
xml_parser_free($parser);
fclose($fp);
?>
Run Example »

Definition and Usage

The xml_parser_free() function frees an XML parser.

Tip: To create an XML parser use the xml_parser_create() function.

Syntax

xml_parser_free(parser)

Parameter Values

Parameter Description
parser Required. Specifies the XML parser to free


Technical Details

Return Value: TRUE on success. FALSE on failure
PHP Version: 4.0+

❮ PHP XML Parser Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.