Small refactoring in Document
Raise instead of returning nil when a class name cannot be resolved
Validation of composite documents