final String[] nodeNames = new String[]{
"complexType", "sequence", "all", "choice"
};
XMLFilter filter = new GroupFilter(new DeletionFilter(
filteredElements,
new ExposeChildrenFilter(nodeNames,
parser)));
// Set up the features that we need
try {
parser.setFeature("http://xml.org/sax/features/namespaces",
true);
} catch (SAXNotSupportedException e) {
throw new IllegalStateException(
"The parser should support all required features (" +
e.getMessage() + ")");
} catch (SAXNotRecognizedException e) {
throw new IllegalStateException(
"The parser should support all required features (" +
e.getMessage() + ")");
}
// Set up the schema configurator needed to populate the schema
// definition.
filter.setContentHandler(new SchemaConfigurator(schema));
// Now parse the schema file itself to populate the schema definition
filter.parse(systemID);
}