}
if(jaxbNamespace == null) {
jaxbNamespace = this.getSchemaTargetNameSpace();
}
JAXBContextImpl context = (JAXBContextImpl) createJAXBContext(classes, jaxbNamespace);
for (DOMResult r : generateJaxbSchemas(context)) {
Document d = (Document) r.getNode();
String targetNamespace = d.getDocumentElement().getAttribute("targetNamespace");
if ("".equals(targetNamespace)) {
targetNamespace = this.getSchemaTargetNameSpace();
d.getDocumentElement().setAttribute("targetNamespace", targetNamespace);
}
NodeList nodes = d.getDocumentElement().getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
if (n instanceof Element) {
Element e = (Element) n;
if (e.getLocalName().equals("import")) {
d.getDocumentElement().removeChild(e);
}
}
}
XmlSchema xmlSchema = xmlSchemaCollection.read(d.getDocumentElement());
for (Class clazz : classes) {
JaxBeanInfo<?> beanInfo = context.getBeanInfo(clazz);
QName qName = getTypeName(beanInfo);
if(qName != null) {
typeTable.addComplexSchema(clazz.getName(), qName);
}
}