Submitted by crounauer on Tue, 2006-02-21 12:40 in Magic Parser
Hi David,
Is it possible to parse two different URL's on the same page.
I have used the first parser to fill in information for use in a form. I would like to add more info below the form, but this requires a different URL!
Every call to MagicParser_parse() resets all internal variables so there shouldn't be a problem.
Remember that your record handler function does not need to be called "myRecordHandler"; so if you need 2 different handler functions just make sure that you use different names - for example:
<?php require("MagicParser.php"); function recordHandler1($record) { // code to handle records from the first file } MagicParser_parse("file1.xml","recordHandler1"); function recordHandler2($record) { // code to handle records from the second file } MagicParser_parse("file2.xml","recordHandler2"); ?>
Hi,
Every call to MagicParser_parse() resets all internal variables so there shouldn't be a problem.
Remember that your record handler function does not need to be called "myRecordHandler"; so if you need 2 different handler functions just make sure that you use different names - for example:
<?php
require("MagicParser.php");
function recordHandler1($record)
{
// code to handle records from the first file
}
MagicParser_parse("file1.xml","recordHandler1");
function recordHandler2($record)
{
// code to handle records from the second file
}
MagicParser_parse("file2.xml","recordHandler2");
?>
Hope this helps!