When reading xml files with a large amount of data, although it supports XPath, it is easier to query, but you need to load them first, which wastes the memory and is relatively slow to use. When reading xml files with a large amount of data, although it supports XPath, it is easier to query, but you need to load them first, which wastes the memory and is relatively slow to use.
If XMLReader is used, it does not need to be cached and the reading speed is very fast. However, it is not convenient to query. XPath is not supported and only supports forward loops through the Reader () method. To avoid the disadvantages of the above two methods, come up with the following solution:
1. use XMLReader to read the content of the XML file to a linked list.
2. you can query the linked list during Query. (you can define the query function in the category of the linked list. you can directly call the function when you want to query it. this is very convenient ).
The results show that the speed and query results are good.
The above is a detailed description of reading XML files with large data volumes. For more information, see other related articles in the first PHP community!