This commit is contained in:
Arjen Poutsma
2008-05-03 21:06:35 +00:00
parent 557fa9d12b
commit e8b552deb4
3 changed files with 14 additions and 3 deletions

View File

@@ -163,8 +163,10 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali
for (int i = 0; i < imports.getCount(); i++) {
XmlSchemaExternal external = (XmlSchemaExternal) imports.getItem(i);
if (external instanceof XmlSchemaImport) {
XmlSchema importedSchema = external.getSchema();
if (importedSchema != null && !processedSchemas.contains(importedSchema)) {
XmlSchemaImport schemaImport = (XmlSchemaImport) external;
XmlSchema importedSchema = schemaImport.getSchema();
if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) &&
importedSchema != null && !processedSchemas.contains(importedSchema)) {
inlineIncludes(importedSchema, processedSchemas);
findImports(importedSchema, processedSchemas);
xmlSchemas.add(importedSchema);

View File

@@ -90,6 +90,15 @@ public class CommonsXsdSchemaCollectionTest extends XMLTestCase {
assertEquals("Invalid amount of XSDs loaded", 1, schemas.length);
}
public void testXmlNamespace() throws Exception {
Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class);
collection.setXsds(new Resource[]{resource});
collection.setInline(true);
collection.afterPropertiesSet();
XsdSchema[] schemas = collection.getXsdSchemas();
assertEquals("Invalid amount of XSDs loaded", 1, schemas.length);
}
public void testCreateValidator() throws Exception {
Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTestCase.class);
collection.setXsds(new Resource[]{a});

View File

@@ -4,7 +4,7 @@
xmlns="http://www.springframework.org/spring-ws/xmlNamespace" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>