All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP一些常用的正则表达式_php资料_编程技术
PHP技巧:正确理解PHP程序编译时的错误信息_php资料_编程技术
DataList中HyperLink数据绑定及链接写法_[Asp.Net教程]
SQL SERVER 2000 数据库备份与还原_[SQL Server教程]
如何在.NET中访问MySQL数据库_[Asp.Net教程]
打造超酷的PHP数据饼图_[PHP教程]
XSL教程:了解XSL的选择模式_[XML教程]
ASP.NET,2.0
探讨SQL2000对XML的支持_[SQL,Server教程]
C#,DataGridView隔行显示不同的颜色_.net资料_编程技术
Reading number is top 10 pictures
BingBingFan apple dew point photo gallery5
The little girl with long hair1
浴室里的美女
Chinese paper-cut grilles art appreciation1
这两天,中国人民到处都可以“看海”了
全球十大灵异酒店
The cat shit
福利是必须的
青春清纯美女大集合1
Take you to walk into the most true north Korea rural1
Download software ranking
1400篇各类破解文章
WebService在.NET中的实战应用教学视频 → 第3集
网页特效实例大全
Unix video tutorial6
Tram sex maniac 2 (H) rar bag16
Kung.Fu.Panda.2
ASP.NET.2.0.XML.高级编程(第3版)
SP4 for SQL2000
Call Of Duty2
SQL2000 For 4IN1
aaa published in(发表于) 2013/12/21 22:34:37 Edit(编辑)
PHP解析XML,元素结构范例_php资料_编程技术

PHP解析XML,元素结构范例_php资料_编程技术

PHP解析XML 元素结构范例_php资料_编程技术-你的首页-uuhomepage.com

  该范例用缩进格式显示一个文档中起始元素的结构。

  显示 XML 元素结构


$file = "data.xml";
$depth = array();

function startElement($parser, $name, $attrs) {
global $depth;
for ($i = 0; $i < $depth[$parser]; $i++) {
print " ";
}
print "$name\n";
$depth[$parser]++;
}

function endElement($parser, $name) {
global $depth;
$depth[$parser]--;
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
?>




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.