Trying to reproduce SWS-176
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.xml.validation;
|
||||
|
||||
import java.io.InputStream;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
@@ -25,6 +26,7 @@ import javax.xml.transform.stream.StreamSource;
|
||||
import junit.framework.TestCase;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.xml.transform.ResourceSource;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXParseException;
|
||||
@@ -102,4 +104,21 @@ public abstract class AbstractValidatorFactoryTestCase extends TestCase {
|
||||
assertEquals("ValidationErrors returned", 3, errors.length);
|
||||
}
|
||||
|
||||
public void testMultipleSchemasValidMessage() throws Exception {
|
||||
Resource[] schemaResources = new Resource[]{
|
||||
new ClassPathResource("multipleSchemas1.xsd", AbstractValidatorFactoryTestCase.class),
|
||||
new ClassPathResource("multipleSchemas2.xsd", AbstractValidatorFactoryTestCase.class)};
|
||||
validator = createValidator(schemaResources, XmlValidatorFactory.SCHEMA_W3C_XML);
|
||||
|
||||
Source document = new ResourceSource(
|
||||
new ClassPathResource("multipleSchemas1.xml", AbstractValidatorFactoryTestCase.class));
|
||||
SAXParseException[] errors = validator.validate(document);
|
||||
assertEquals("ValidationErrors returned", 0, errors.length);
|
||||
validator = createValidator(schemaResources, XmlValidatorFactory.SCHEMA_W3C_XML);
|
||||
document = new ResourceSource(
|
||||
new ClassPathResource("multipleSchemas2.xml", AbstractValidatorFactoryTestCase.class));
|
||||
errors = validator.validate(document);
|
||||
assertEquals("ValidationErrors returned", 0, errors.length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<multipleSchemas1 xmlns="http://www.springframework.org/spring-ws/test/multipleSchemas1">abc</multipleSchemas1>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.springframework.org/spring-ws/test/multipleSchemas1"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<element name="multipleSchemas1">
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<pattern value="[a-c]+"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</element>
|
||||
|
||||
</schema>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<multipleSchemas2 xmlns="http://www.springframework.org/spring-ws/test/multipleSchemas2">123</multipleSchemas2>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.springframework.org/spring-ws/test/multipleSchemas2"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<element name="multipleSchemas2">
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<pattern value="[1-3]+"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</element>
|
||||
|
||||
</schema>
|
||||
Reference in New Issue
Block a user