Parsing large XML files

Discussion in 'PHP' started by siu00as, Apr 28, 2007.

  1. #1
    Hi,
    I've been trying to parse a large xml product feed so that I can then upload the data to my database.

    At the moment i've been trying to parse the file using SimpleXML. But the file appears to be too big and returns the following error:

    Warning: simplexml_load_file() [function.simplexml-load-file]: mailorder.xml:11427: parser error : out of memory

    Any ideas of how to parse large xml files?

    Thanks in advance
     
    siu00as, Apr 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try putting this at the top of your script:
    
    ini_set('memory_limit', -1);
    
    PHP:
     
    nico_swd, Apr 28, 2007 IP
  3. siu00as

    siu00as Peon

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply, unfortunately the file still won't parse.

    Any other suggestions?
     
    siu00as, Apr 28, 2007 IP
  4. malluwood

    malluwood Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it has been fixed in latest php version.So try to use latest version
    http://bugs.php.net/bug.php?id=38604
     
    malluwood, May 2, 2007 IP