Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: PHP 5, XSL transformations of big files

From: "Joe Fawcett" <joefawcett@---------.------>
To: NULL
Date: 5/3/2008 5:03:00 PM



"Meglio" <x.meglio@g...> wrote in message 
news:17d78148-5bff-4483-a00a-39c670f4b484@2......
> Hi.
>
> I'm going to make in auto some tasks that I'm doing manually every
> day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
> to transform it to MySQL queries file.
>
> I have used 3rd tools to process XSLT and it takes few seconds to
> process my big XML file.
>
> But now I'm moving to PHP so I'm trying to use XSL PHP extension to
> apply my XSL file. But... it takes minutes... I allowed 10 minutes
> ( set_time_limit(600) ) and it still crashes and says that time
> excited.
>
> So please somebody help me to find a way out of the impasse. I can't
> move forward now because of slow XSL processing.
>
> The code I'm using is:
>
> *******
> // Load the XML source
> $xml = new DOMDocument;
> $xml->load('extracted/marketplace_feed_v1.xml');
>
> $xsl = new DOMDocument;
> $xsl->load('cb_marketplace_feed_compact.xsl');
>
> // Configure the transformer
> $proc = new XSLTProcessor;
> $proc->importStyleSheet($xsl); // attach the xsl rules
>
> $sqlCommands = $proc->transformToXML($xml);
> if ($sqlCommands == FALSE)
> {
>        echo "XSLT transformation failed";
>        exit;
>
> }
>
> if (file_put_contents('cbfeed.sql', $sqlCommands) == FALSE);
> {
>        echo 'Failed to save XSLT transformation result to the file
> "cbfeed.sql"';
>        exit;
>
> }
>
> *******
>
> You can upload files used in my script here:
>
> http://megliosoft.org/meglio/cbfeed/marketplace_feed_v1.xml
> http://megliosoft.org/meglio/cbfeed/cb_marketplace_feed_compact.xsl
>
> Any information may help.
>
> Thanks,
> Anton
Perhaps move to a different programming model? You could use a streaming 
interface such as SAX and create the SQL statements as you go for example. I 
don't really know what capabilities PHP has in this regard.

-- 

Joe Fawcett (MVP - XML)
http://joe.fawcett.name 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent