Paul Nagle wrote:
Hi,
Can anyone direct me to an example of where PHP is used to parse a basic
XML file, and use the contents of this file to generate a HTML page? I am
trying to implement a troubleshooting app, where the different paths or
scenarios through the troubleshooter are stored in an XML file, and
presented to the user through a series of radio buttons.
I need to implement this using PHP and have very little experience. Any help
would be greatly appreciated.
The options are :
- parsing the XML file with a SAX parser. It's the simplest parser, but
maintains no state so you have to do it by yourself.
- parsing the XML file with a DOM parser. It builds an in-memory
representation of the XML data as a tree of objects. Probably not the
simplest choice here
- transforming the XML to HTML with XSLT. You have to learn XSLT and
write the approriate XSL stylesheets, but that's not that complex, and
once done the PHP code by itself is quite simple.
You may want to try XSLT ?-)
My 2 cents,
Bruno