FileWriter writer = new FileWriter(filexsd);
filexsd = generateGrantXSD(writer, dir, metadataALL, filexsd,
new String[] { "grants", "grant" });
// create xsd validator
SchemaFactory factory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaSource = new StreamSource(filexsd);
Schema schema = factory.newSchema(schemaSource);
// validate source xml to xsd
Validator validator = schema.newValidator();
validator.validate(new StreamSource(filexml));
// parse xml to dom