- apache
- api
- beelzebub
- benchmarking
- captcha
- crosswords
- developers
- dom
- domdocument
- dtd
- fifteensquared
- fireeagle
- lamp
- m255
- maths
- mobile
- mobileweb
- mono
- ms221
- mst121
- openuniversity
- overtheair
- overtheair08
- php
- phparchitect
- playphone
- python
- recaptcha
- recruitment
- rest
- slideshare
- softwarearchitecture
- spam
- subversion
- sucks
- svn
- talks
- ted
- testing
- tutorial
- versioncontrol
- wurfl
- xml
- yammer
- zendframework
- zendplatform
9 Mar 2009, 4:59 p.m.
Adding a Doctype Declaration to a DOMDocument in PHP
I've recently been spending quite a lot of time with PHP's DOM extension, which is extremely useful for both generating and parsing XML.
In this particular case, I'm generating XML, and it's imperative that the XML markup which the code is generating should contain a Doctype declaration (DTD). It isn't hard to do that using DOM, but it did take a little bit of hunting around in the manual and online, so here's a quick overview of how to add a Doctype declaration to a DOMDocument.
Read more »