Hi, I have an xml file containing about 12,000 entries. I have the code written and it works fine, it just takes some time to parse the XML file and return the content. Is there a way to speed up this process?
My code is:
<?php $dom = new DOMDocument(); $dom->load('comics.xml'); foreach ($dom->getElementsByTagName('record') as $entry) { $title = $entry->getElementsByTagName('title')->item(0)->textContent; echo $title; } ?>
XML file (just 1 demo where there is no link to all lol):
<?xml version='1.0' encoding='utf-8'?> <calibredb> <record> <id>1</id> <uuid>991639a0-7cf6-4a34-a863-4aab8ac2921d</uuid> <publisher>Marvel Comics</publisher> <size>6109716</size> <title sort="Iron Man v1 101">Iron Man v1 101</title> <authors sort="Unknown"> <author>Unknown</author> </authors> <timestamp>2012-04-15T18:49:22-07:00</timestamp> <pubdate>2012-04-15T18:49:22-07:00</pubdate> <cover>M:/Comics/Unknown/Iron Man v1 101 (1)/cover.jpg</cover> <formats> <format>M:/Comics/Unknown/Iron Man v1 101 (1)/Iron Man v1 101 - Unknown.zip</format> </formats> </record> </calibredb>
source share