parsing an XML file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

parsing an XML file

Post by bruceg »

I am trying to output data from an XML file using XSLT.

is this the correct syntax?

Code: Select all

<?php
$xml = simplexml_load_file('test.xml');
$proc = new XsltProcessor( 'test.xsl');
$proc->importStylesheet($xsl);
$newxml = $proc->transformToDoc($xml);
print $newxml->saveXML();
?>
I get an error
Fatal error: Call to undefined function: simplexml_load_file() in /hsphere/local/home/bruceg/inspired-evolution.com/XML.php on line 2
jrd
Forum Commoner
Posts: 53
Joined: Tue Mar 14, 2006 1:30 am

Post by jrd »

are you using php5
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

no, 4.4.1
jrd
Forum Commoner
Posts: 53
Joined: Tue Mar 14, 2006 1:30 am

Post by jrd »

i think you need php5 to run that command.

http://my2.php.net/simplexml_load_file
Post Reply