1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package tests;
21
22 import junit.framework.TestCase;
23 import org.apache.ws.commons.schema.XmlSchema;
24 import org.apache.ws.commons.schema.XmlSchemaCollection;
25 import org.w3c.dom.Document;
26
27 import javax.xml.parsers.DocumentBuilderFactory;
28 import javax.xml.namespace.QName;
29 import java.io.File;
30
31 public class RecursiveImportTest extends TestCase {
32
33 public void testSchemaImport() throws Exception{
34
35 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
36 documentBuilderFactory.setNamespaceAware(true);
37 Document doc = documentBuilderFactory.newDocumentBuilder().
38 parse(Resources.asURI("circular/a.xsd"));
39
40 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
41 schemaCol.setBaseUri(Resources.TEST_RESOURCES + "/circular");
42 XmlSchema schema = schemaCol.read(doc,null);
43 assertNotNull(schema);
44
45
46
47
48 assertNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
49 assertNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
50
51 }
52
53
54 }