Xml cleaner

These are the tools I've used to get up to the "Revalidate" step on #717.

It might be good to sit down together make sure the heuristics here are good, and that the output is really what we want: For instance, I've created empty stub elements because in many places the schema required an element, but doesn't actually require content. Is this ok?