<?
/*
(c) 2000 Hans Anderson Corporation. All Rights Reserved.
You are free to use and modify this class under the same
guidelines found in the PHP License.
-----------
bugs/me:
http://www.hansanderson.com/php/
me@hansanderson.com
showstv@163.com
-----------
Version 1.0
- 1.0 is the first actual release of the class. It's
finally what I was hoping it would be, though there
are likely to still be some bugs in it. This is
a much changed version, and if you have downloaded
a previous version, this WON'T work with your existing
scripts! You'll need to make some SIMPLE changes.
- .92 fixed bug that didn't include tag attributes
(to use attributes, add _attributes[array_index]
to the end of the tag in question:
$xml_html_head_body_img would become
$xml_html_head_body_img_attributes[0],
for example)
-- Thanks to Nick Winfield <nick@wirestation.co.uk>
for reporting this bug.
- .91 No Longer requires PHP4!
- .91 now all elements are array. Using objects has
been discontinued.
*/
class xml_container{
function store($k,$v) {
$this->{$k}[] = $v;
}
}
/* parses the information */
/*********************************
* 类定义开始
*
*********************************/
class xml{
// initialize some variables
var $current_tag=array();
var $xml_parser;
var $Version = 1.0;
var $tagtracker = array();
/* Here are the XML functions needed by expat */
/* when expat hits an opening tag, it fires up this function */
function startElement($parser, $name, $attrs){
array_push($this->current_tag, $name); // add tag to the cur. tag array
$curtag = implode("_",$this->current_tag); // piece together tag
/* this tracks what array index we are on for this tag */
if(isset($this->tagtracker["$curtag"])) {
&