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 ?

Re: How to read Big XML file (>500 MB) in PHP 80 80

for xml look at this xmlreader

Re: How to read Big XML file (>500 MB) in PHP 80 80

Check out DOMDocument() and DOMXPath()

Re: How to read Big XML file (>500 MB) in PHP 80 80

@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 ???

Re: How to read Big XML file (>500 MB) in PHP 80 80

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.

Re: How to read Big XML file (>500 MB) in PHP 80 80

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

Re: How to read Big XML file (>500 MB) in PHP 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.