Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

xml file sequential read in php

Avatar of Borsec
BorsecFlag for Romania asked on
4 Comments1 Solution426 ViewsLast Modified:
I have the following xml file:
<Table xmlns:myUtils="uniSyncDc.Logic">
    <insert>INSERT INTO </insert>
    <delete />
60000 times  </statement>  <statement>
I am reading this file in the following way
$docStatementsFile = new DOMDocument('1.0', 'utf-8');
            $statementss = $docStatementsFile->getElementsByTagName( "statement");
            foreach($statementss as $statement)
                  $deletes = $statement->getElementsByTagName( CONSTANTS::DELETE);
                  $delete = utf8_decode($deletes->item(0)->nodeValue);
               $Updates = $statement->getElementsByTagName( CONSTANTS::UPDATE);
                  $update =  utf8_decode($Updates->item(0)->nodeValue);
               $insertss = $statement->getElementsByTagName( CONSTANTS::INSERT );
                  $insert = utf8_decode($insertss->item(0)->nodeValue);
in this way I am loading all the 60000 entrys in memory and I dont want this because I am using a lot of memory.
How can I read this xml file sequentially, like I read a statement from the file nd execute it, I read the next statement and execute it, and so on.
Avatar of Justin Mathews
Justin Mathews

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers