Skip to content

Commit e8b552d

Browse files
committed
SWS-339
1 parent 557fa9d commit e8b552d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ private void findImports(XmlSchema schema, List processedSchemas) {
163163
for (int i = 0; i < imports.getCount(); i++) {
164164
XmlSchemaExternal external = (XmlSchemaExternal) imports.getItem(i);
165165
if (external instanceof XmlSchemaImport) {
166-
XmlSchema importedSchema = external.getSchema();
167-
if (importedSchema != null && !processedSchemas.contains(importedSchema)) {
166+
XmlSchemaImport schemaImport = (XmlSchemaImport) external;
167+
XmlSchema importedSchema = schemaImport.getSchema();
168+
if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) &&
169+
importedSchema != null && !processedSchemas.contains(importedSchema)) {
168170
inlineIncludes(importedSchema, processedSchemas);
169171
findImports(importedSchema, processedSchemas);
170172
xmlSchemas.add(importedSchema);

xml/src/test/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollectionTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ public void testCircular() throws Exception {
9090
assertEquals("Invalid amount of XSDs loaded", 1, schemas.length);
9191
}
9292

93+
public void testXmlNamespace() throws Exception {
94+
Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class);
95+
collection.setXsds(new Resource[]{resource});
96+
collection.setInline(true);
97+
collection.afterPropertiesSet();
98+
XsdSchema[] schemas = collection.getXsdSchemas();
99+
assertEquals("Invalid amount of XSDs loaded", 1, schemas.length);
100+
}
101+
93102
public void testCreateValidator() throws Exception {
94103
Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTestCase.class);
95104
collection.setXsds(new Resource[]{a});

xml/src/test/resources/org/springframework/xml/xsd/xmlNamespace.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns="http://www.springframework.org/spring-ws/xmlNamespace" elementFormDefault="qualified"
55
attributeFormDefault="unqualified">
66

7-
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
7+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
88

99
<xsd:element name="GetOrderRequest">
1010
<xsd:complexType>

0 commit comments

Comments
 (0)