1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package tests.ext;
17
18 import junit.framework.TestCase;
19
20 import javax.xml.parsers.DocumentBuilderFactory;
21
22 import org.w3c.dom.Document;
23 import org.apache.ws.commons.schema.XmlSchemaCollection;
24 import org.apache.ws.commons.schema.XmlSchema;
25 import org.apache.ws.commons.schema.XmlSchemaElement;
26 import tests.Resources;
27
28 import java.util.Iterator;
29 import java.util.Map;
30 import java.io.ByteArrayOutputStream;
31
32
33
34
35 public class PlainExtensionSerializerTest extends TestCase {
36
37 public void testSerialization() throws Exception {
38
39
40 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
41 documentBuilderFactory.setNamespaceAware(true);
42 Document doc = documentBuilderFactory.newDocumentBuilder().
43 parse(Resources.asURI("/external/externalAnnotations.xsd"));
44
45 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
46 XmlSchema schema = schemaCol.read(doc,null);
47 assertNotNull(schema);
48
49 schema.write(new ByteArrayOutputStream());
50 }
51
52
53 public void testSerialization1() throws Exception {
54
55
56 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
57 documentBuilderFactory.setNamespaceAware(true);
58 Document doc = documentBuilderFactory.newDocumentBuilder().
59 parse(Resources.asURI("/external/externalElementAnnotations.xsd"));
60
61 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
62 XmlSchema schema = schemaCol.read(doc,null);
63 assertNotNull(schema);
64
65 schema.write(new ByteArrayOutputStream());
66 }
67 }