Hi all, I was trying to use the above script to load a XML file<?php
header("Content-type: text/xml");
$xml = new DOMDocument;
$xml->load("input.xml");
$xsl = new DOMDocument();
$xsl->load("xsl.xsl");
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
for the input.
Both the .php file and the .xml file are in the same directory,
yet it always returns a following error message:
-----------...
Only one top level element is allowed in an XML document. Error processing resource
...
...
domdocument() expects at least 1 parameter, 0 given in... (no full path was given)
I have then tried the script from PHP.net's tutorial, just to see if it would work, but same error message... (I did make a XML file called 'book.xml' and put it in the same directory as the PHP file)
http://us2.php.net/manual/en/functio...ument-load.php
-----------<?php
$doc = DOMDocument::load('book.xml');
echo $doc->saveXML();
$doc = new DOMDocument();
$doc->load('book.xml');
echo $doc->saveXML();
?>
Can anyone give me a hand? Thanks in advance!!



Reply With Quote

Bookmarks