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.XmlSchemaCollection;
24
25 import javax.xml.transform.stream.StreamSource;
26 import java.io.ByteArrayInputStream;
27
28
29
30
31 public class TestLocalUnnamedSimpleType extends TestCase {
32 String schemaXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
33 "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\"\n" +
34 "targetNamespace=\"http://finance.example.com/CreditCardFaults/xsd\"\n" +
35 "xmlns:tns=\"http://finance.example.com/CreditCardFaults/xsd\"\n" +
36 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
37 "xsi:schemaLocation=\"http://www.w3.org/2001/XMLSchema\n" +
38 " http://www.w3.org/2001/XMLSchema.xsd\">\n" +
39 "\n" +
40 "<element name=\"tns:CreditCardNumber\" type=\"string\"></element>\n" +
41 "\n" +
42 "<element name=\"tns:CreditCardType\">\n" +
43 "<simpleType>\n" +
44 "<restriction base=\"string\">\n" +
45 "<enumeration value=\"AMEX\" />\n" +
46 "<enumeration value=\"MASTERCARD\" />\n" +
47 "<enumeration value=\"VISA\" />\n" +
48 "</restriction>\n" +
49 "</simpleType>\n" +
50 "</element>\n" +
51 "</schema> ";
52
53 public void testLocalUnnamedSimpleType() throws Exception {
54 XmlSchemaCollection schema = new XmlSchemaCollection();
55 schema.read(new StreamSource(new ByteArrayInputStream(schemaXML.getBytes())), null);
56 }
57 }