(e-mail address removed) schrieb:
Many others have asked this before.
The official anwer is that you cant just
concatenate files because XML data is allowed
to have one root element only.
Some parsers seem to tolerate XML files that
consist of a sequence of XML root elements.
But remember that these files are not well-
formed XML files anymore, although the look so.
Thanks. The new xml file does not need a new root element. All what I
want is to transform each xml file and store all of them in a new xml
file. I need help on how I can store the new.xml in a variable,
concatenate "new.xml" and "nth_old.xml" and then store it back as
"new.xml". This is what I have done:
<?php
for ($i = 0; $i < 50) {
/* load the xml file and stylesheet as dom documents */
$xsl = new DomDocument();
$xsl->load("transform.xsl");
$old = $i."old.xml";
$inputdom = new DomDocument();
$inputdom->load($old);
/* create the processor and import the stylesheet */
$proc = new XsltProcessor();
$xsl = $proc->importStylesheet($xsl);
/* transform and output the xml document */
$newdom = $proc->transformToDoc($inputdom);
print $newdom->saveXML();
print $newdom->save("new.xml");
}
?>
Ofuuzo