How to read 550 MB XML file in php? I couldn't put data in php file like:

$xml =<<<EOT 
<?xml version="1.0" encoding="utf-8"?>
<data>
.....
...
</data>
EOT; 

In addition, when i did from command line, it "kill" the process. Any idea ?

Recommended Answers

All 7 Replies

@pzuurveen & @Unimportant :

I had already checked it out. If possible, I would like to have other input.

Anybody have any idea to solve it out ???

What do you mean by other input?
You can modify the DOMXPath after it is constructed, though it takes a little doing.

I'm sorry, your request seems ambiguous at this moment. You'll have to literate yourself more specifically if you would like to find a specific answer.

from php.net about xmlreader

The XMLReader extension is an XML Pull parser. The reader acts as a cursor going forward on the document stream and stopping at each node on the way.

That means that the file is not loaded into memory but can be read one part at a time.
There is a usefull example on the intro page

I had used DomDocument. Is it possible to read large XML file with this?

THANKS IN ADVANCED.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.