-
-
//第一步 创建解析器 xml_parser_create(编码); - $xml = xml_parser_create('utf-8');
- //xml_parser_set_option — 为指定 XML 解析进行选项设置
- //xml_parser_set_option($xml,XML_OPTION_CASE_FOLDING,false); false原样输出
- //注册事件,将遇到开始和结束表计时使用什么函数
- xml_set_element_handler($xml,"starttag","endtag");
xml_set_character_data_handler($xml,"content");
function starttag($x,$tagName,$args){
- if($tagName=="USERS")
- echo "
{$tagName}";
- else if($tagName == "USER"){
- echo "
";
- echo "
{$args['ID']} | ";
- }else
- echo "
";
- }
function endtag($x,$tagName){
- if($tagName=="USERS")
- echo "
| ";
- else if($tagName == "USER")
- echo "
|
";