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
8 import javax.xml.namespace.QName;
9 import javax.xml.transform.stream.StreamSource;
10 import java.io.FileInputStream;
11 import java.io.InputStream;
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 public class BlockTest extends TestCase {
29 public void testMixedContent() throws Exception {
30 QName ELEMENT_QNAME = new QName("http://soapinterop.org/xsd",
31 "complexElt");
32
33
34 InputStream is = new FileInputStream(Resources.asURI("block.xsd"));
35 XmlSchemaCollection schema = new XmlSchemaCollection();
36 XmlSchema s = schema.read(new StreamSource(is), null);
37
38 XmlSchemaElement elementByName = s.getElementByName(ELEMENT_QNAME);
39 assertNotNull(elementByName);
40
41 String value = elementByName.getBlock().getValue();
42 assertEquals("restriction",value);
43
44 }
45 }