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

PHP的XML Parser(转)

WBOY
Release: 2016-06-23 14:35:26
Original
1046 people have browsed it

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

 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template