I am generating some XML Schemas and would like to ensure that our generator is creating valid XML Schema documents (Not XML). I was trying to come up with the code to valid
I agree with Petru that validating a schema against the schema for schema documents is not a very useful thing to do, because it won't detect all errors in your schema. The only real way to ensure that your schema is valid is to pass it to a schema processor.
For example, with Saxon
Processor p = new Processor(true);
StreamSource ss = new StreamSource(new File('mySchema.xsd');
p.getSchemaManager().load(ss);
will tell you whether your schema is valid or not.