especht
10-08-2008, 04:54 PM
Hello. I am trying to create an XML document in PHP that I will need to transform using XSLT. I'm a recovering ASP programmer just getting going with PHP, and I'm having some trouble determining which XML library to use.
I was trying to create dom documents using code like this:
<?php
include '../config/config.php';
$dom=new DomDocument();
$elementRoot=$dom->createElement('test');
$dom->appendChild($elementRoot);
echo $dom->saveXML();
exit();
?>
This works - sometimes. About half of the page refreshes I'm getting the following error:
Fatal error: Class 'DomDocument' not found in /www/eh6503-1/public_html/cms/testLibXML.php on line 3
I looked at my phpinfo(), and it says the following that are probably relevant:
PHP Version 5.1.6
Under "Configure Command": '--disable-dom'
Under "dom":
DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.6.26
Under "libxml":
libxml
libXML support active
libXML Version 2.6.26
libXML streams enabled
Under "SimpleXML":
Simplexml support enabled
Revision $Revision: 1.151.2.22 $
Schema support enabled
Under "xml":
XML Support active
XML Namespace Support active
libxml2 Version 2.6.26
Under "xmlreader":
XMLReader enabled
Under "xsl":
XSL enabled
libxslt Version 1.1.17
libxslt compiled against libxml Version 2.6.26
EXSLT enabled
libexslt Version 1.1.17
==
I'm beginning to suspect that the code I'm using might be PHP 4 code. Please let me know if you have any suggestions on how I can get this working consistently, and advice as to which libraries you think are the forward-thinking way to go.
Thanks,
Erich
I was trying to create dom documents using code like this:
<?php
include '../config/config.php';
$dom=new DomDocument();
$elementRoot=$dom->createElement('test');
$dom->appendChild($elementRoot);
echo $dom->saveXML();
exit();
?>
This works - sometimes. About half of the page refreshes I'm getting the following error:
Fatal error: Class 'DomDocument' not found in /www/eh6503-1/public_html/cms/testLibXML.php on line 3
I looked at my phpinfo(), and it says the following that are probably relevant:
PHP Version 5.1.6
Under "Configure Command": '--disable-dom'
Under "dom":
DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.6.26
Under "libxml":
libxml
libXML support active
libXML Version 2.6.26
libXML streams enabled
Under "SimpleXML":
Simplexml support enabled
Revision $Revision: 1.151.2.22 $
Schema support enabled
Under "xml":
XML Support active
XML Namespace Support active
libxml2 Version 2.6.26
Under "xmlreader":
XMLReader enabled
Under "xsl":
XSL enabled
libxslt Version 1.1.17
libxslt compiled against libxml Version 2.6.26
EXSLT enabled
libexslt Version 1.1.17
==
I'm beginning to suspect that the code I'm using might be PHP 4 code. Please let me know if you have any suggestions on how I can get this working consistently, and advice as to which libraries you think are the forward-thinking way to go.
Thanks,
Erich