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.apache.ws.commons.schema.constants.Constants;
26 import org.w3c.dom.Document;
27
28 import javax.xml.parsers.DocumentBuilderFactory;
29 import java.util.Map;
30
31 public class ExternalAttTest extends TestCase {
32
33
34 public void testExternalAtt() throws Exception{
35
36 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
37 documentBuilderFactory.setNamespaceAware(true);
38 Document doc = documentBuilderFactory.newDocumentBuilder().
39 parse(Resources.asURI("externalAttributes.xsd"));
40
41 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
42 XmlSchema s = schemaCol.read(doc.getDocumentElement());
43
44
45 Map metaInfoMap = s.getMetaInfoMap();
46 assertNotNull(metaInfoMap);
47
48 Map extenalAttributeMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);
49 assertNotNull(extenalAttributeMap);
50
51
52 assertEquals(1,extenalAttributeMap.size());
53
54
55 }
56
57 }