Re: Parsing XML
| From: | Ben Gollmer | Date: | Wed, 14 Nov 2001 02:58:27 +0000 |
| Subject: | Re: Parsing XML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74536@lists.php.net to get a copy of this message | ||
Do something like this:
function parseXML($xmlFile)
{
$theParser = xml_parser_create();
xml_set_element_handler($theParser, "startElementHandler", "endElementHandler");
//parse your XML here
return $attributeArray;
}
function startElementHandler($theParser, $theTag, $theAttrs)
{
global $attributeArray;
//do your attribute handling here; maybe something like this
$attributeArray[] = $theAttrs;
}
Ben
On Tuesday, November 13, 2001, at 07:34 PM, Michael Harris wrote:
Can anybody tell me if there is a way to build an array or some other means of collecting the attributes from the Start Element Handler so I can return them back to my main application? Thanks for any help, -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net