Home >Backend Development >PHP Tutorial >PHP的XML Parser(转)

PHP的XML Parser(转)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 14:35:261069browse

PHP处理XML文件

一、
读取,更新(创建或者操作)一个XML文档,需要XML解析器

。有两种XML parsers:

1. Tree-based parser:
将XML文档转化为DOM Tree结构 
PHP中为DOM parser
详情参看
http://www.w3schools.com/php/php_xml_dom.asp

2. Event-based parser: 
读取XML文档,然后将XML中的内容看作各种事件 ,某个特定的事件发生就调用某一个特定的函数
PHP中为Expat parser
详情参看
http://www.w3schools.com/php/php_xml_parser_expat.asp
和  http://www.w3schools.com/php/php_ref_xml.asp

比Tree-based parser快


二、PHP中可以使用的其他的访问XML文件的类库还有
SimpleXML Functions
http://www.w3schools.com/php/php_ref_simplexml.asp 

PHP libxml Functions
http://www.w3schools.com/php/php_ref_libxml.asp


根据实际情况选择最适合的XML Parser来读取和分析XML文档。

 

http://blog.csdn.net/omohe/article/details/1924643

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Resource php资源Next article:php使用leveldb