XML Merge Optimization with PHP

sweetrose599

New Member
I am hoping someone can point me in a right direction. I am writing a PHP app, which will basically pull about 10-15 xml feeds, with about 30 nodes in each of them with different formats, and then cluster them into various categories. So far I was able to write a piece of php to transform/map each feed via XSLT to a standardized format (xml elements are standardized across all output fields). I am able to do a simple include and include them all to output a single feed, problem comes that the feed is now about 400-500 nodes with 17 elements per node, and takes forever to load. That's where I'm stuck, I've tried XMLReader/XMLWriter command, but am getting an error on XML Writer. I am using the below code \[code\]$xml1 = new XMLReader();$xml1->open('convert1.php');$xml2 = new XMLReader();$xml2->open('convert2.php'); $name = 'xmlroot'; $write = new XMLWriter(); $write->startElement($name);\[/code\]This is the error I get:\[code\]Warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in C:\wamp\www\mergetest\merge1.php on line 22\[/code\]My XML is structured like this:\[code\]<xmlroot><xmlnode><xmlelement></xmlelement></xmlnode></xmlroot>\[/code\]Convert PHP code:\[code\] <?php$xml = new DOMDocument();$xml->load('xmlfeed');$xsl = new DOMDocument;$xsl->load('xsl.xsl');$proc = new XSLTProcessor();$proc->importStyleSheet($xsl);echo $proc->transformToXML($xml);\[/code\]I'm still new to PHP, so if there are noob mistakes or I didn't include something, please don't flame lol I'm just trying to learn, and any and all help are appreciated. I tried looking at the PHP reference/tutorial, but it doesn't seem to help.
 
Back
Top