Home > Backend Development > XML/RSS Tutorial > Regarding the problem of reading XML files with large amounts of data

Regarding the problem of reading XML files with large amounts of data

怪我咯
Release: 2017-04-07 11:31:36
Original
2171 people have browsed it

For XML files with a large amount of data, when using xmlDocument to read, although XPath is supported and the query is more convenient, it needs to be loaded first, which wastes memory and is slower to use.

If you use XMLReader, there is no need for caching and the reading speed is very fast, but it is not so convenient if you want to query. XPath is not supported and you can only forward loop through the Reader() method. In order to avoid the shortcomings of the above two methods, we came up with the following plan:

1. First use XMLReader to read the contents of the XML file into a linked list.

2. When querying, just query the linked list (you can define the query function in the class that defines the linked list, and just call the function directly when querying, which is very convenient).

The results prove that: the speed and query effect are both very good.

The above is the detailed content of Regarding the problem of reading XML files with large amounts of data. For more information, please follow other related articles on the PHP Chinese website!

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