Add a sanity check for ddoc

so it is at least a XML file, plus code formatting.
Add bdoc mimetype.
Move classes to their own files.