1 package tests;
2
3 import junit.framework.TestCase;
4 import org.apache.ws.commons.schema.XmlSchema;
5 import org.apache.ws.commons.schema.XmlSchemaCollection;
6 import org.apache.ws.commons.schema.XmlSchemaElement;
7 import org.apache.ws.commons.schema.XmlSchemaType;
8
9 import javax.xml.namespace.QName;
10 import javax.xml.transform.stream.StreamSource;
11 import java.io.FileInputStream;
12 import java.io.InputStream;
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 public class MixedContentTest extends TestCase {
30 public void testMixedContent() throws Exception {
31 QName ELEMENT_QNAME = new QName("http://soapinterop.org/xsd",
32 "complexElt");
33
34
35 InputStream is = new FileInputStream(Resources.asURI("mixedContent.xsd"));
36 XmlSchemaCollection schema = new XmlSchemaCollection();
37 XmlSchema s = schema.read(new StreamSource(is), null);
38
39 XmlSchemaElement elementByName = s.getElementByName(ELEMENT_QNAME);
40 assertNotNull(elementByName);
41
42 XmlSchemaType schemaType = elementByName.getSchemaType();
43 assertNotNull(schemaType);
44
45 assertTrue(schemaType.isMixed());
46 }
47 }