dcsimg

PHPBuilder: Using PHP and XML with Apache Cocoon

By ServerWatch Staff (Send Email)
Posted Jun 19, 2000


"First off, for those of you who don't know what Cocoon is, check out http://xml.apache.org where you can download the source and read up on it. In short Cocoon is a suite of Java Servlets that sit on your server waiting for .xml pages and then - if applicable - it applies the relevant XSL transformations. With one XML page and different XSL pages you can deliver rendered output suitable for your Browser, for example HTML for your Desktop or WML for your WAP device."

Prompted by a few postings to the PHP4Beta list I realised that it would be possible to employ a workaround and still use PHP, so I set off to see if I could get it to work. Needless to say I did, so here is a very simple example of using PHP to generate XML dynamically and then using Cocoon to give me browser friendly mark-up.

"I've been playing with Cocoon as a 'learning' project for some time now but my main problem has been that of generating the XML dynamicly by using PHP and then using Cocoon to do the transformations. You can't embed PHP into a .xml page because Cocoon doesn't recognise it and to write XSP's I needed to learn Java, which at the current time is not an option for me."

"Prompted by a few postings to the PHP4Beta list I realised that it would be possible to employ a workaround and still use PHP, so I set off to see if I could get it to work. Needless to say I did, so here is a very simple example of using PHP to generate XML dynamically and then using Cocoon to give me browser friendly mark-up."

Page 1 of 1


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.