xml_get_current_line_number($this->xml_parser));
}
// we are done with the parser, so let's free it
xml_parser_free($this->xml_parser);
}//end constructor: function xml()
}//thus, we end our class xml
?>
操作方法:
require('class.xml.php');
$file = "data.xml";
$data = implode("",file($file)) or die("could not open XML input file");
$obj = new xml($data,"xml");
print $xml["hans"][0]->num_results[0];
for($i=0;$i<sizeof($xml["hans"]);$i++) {
print $xml["hans"][$i]->tag[0] . " ";
}
To print url attributes (if they exist):
print $xml["hans"][0]->attributes[0]["size"];
}
// we are done with the parser, so let's free it
xml_parser_free($this->xml_parser);
}//end constructor: function xml()
}//thus, we end our class xml
?>
操作方法:
require('class.xml.php');
$file = "data.xml";
$data = implode("",file($file)) or die("could not open XML input file");
$obj = new xml($data,"xml");
print $xml["hans"][0]->num_results[0];
for($i=0;$i<sizeof($xml["hans"]);$i++) {
print $xml["hans"][$i]->tag[0] . " ";
}
To print url attributes (if they exist):
print $xml["hans"][0]->attributes[0]["size"];
| 对此文章发表了评论 |
