I'm going to be adding the schema stuff here in another pull request - I'll add in better DOM semantics too.