Creating an XML file programmatically from scratch

What's the best way to programmatically create an XML file from scratch, using data from a database and config files? What classes should I use? How should I approach the problem? We haven't set a firm DTD/XSD schema yet, so I won't be able to use either dtd's or xsd's to validate the structure. Thanks.