On Builder.au, there's a new tutorial talking about the dynamic construction of an XML document using the DOM functionality already built into most PHP installs out there.
They work through the different steps:
- Creating the Doctype declaration
- Adding elements and text nodes
- Adding attributes
- Adding CDATA blocks and processing instructions
- Saving the results