* @return
* @throws XMLStreamException
*/
private XMLValidationSchema getValidator(XmlSchemaCollection schemas) throws XMLStreamException {
Map<String, InputSource> sources = new TreeMap<String, InputSource>();
XmlSchemaSerializer serializer = new XmlSchemaSerializer();
NamespaceMap namespaceContext = new NamespaceMap();
for (XmlSchema sch : schemas.getXmlSchemas()) {
String uri = sch.getTargetNamespace();
LOG.info(uri);
if (sch.getNamespaceContext() == null) {
sch.setNamespaceContext(namespaceContext);
}
Document[] serialized;
try {
serialized = serializer.serializeSchema(sch, false);
} catch (XmlSchemaSerializerException e) {
throw new RuntimeException(e);
}
DOMSource domSource = new DOMSource(serialized[0]);
Reader schemaReader = getSchemaAsStream(domSource);