Share schema export code
Better class generating in schema export

- test whether file exists
- use new instead of eval
Use new instead of eval