File: SimpleGroups.java

package info (click to toggle)
libjibx1.2-java 1.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,260 kB
  • sloc: java: 75,013; xml: 14,068; makefile: 17
file content (142 lines) | stat: -rw-r--r-- 5,238 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

package org.jibx.schema.elements;

import org.jibx.schema.SchemaTestBase;

/**
 * Test handling of schemas with simple group and attributeGroup components.
 */
public class SimpleGroups extends SchemaTestBase
{
    public static final String GROUP_EMPTY_SCHEMA =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'>\n" +
        "  <group name='simple'>\n" +
        "    <sequence/>\n" +
        "  </group>\n" +
        "</schema>";
    
    public static final String ATTRIBUTEGROUP_EMPTY_SCHEMA =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'>\n" +
        "  <attributeGroup name='simple'/>\n" +
        "</schema>";
    
    public static final String GROUP_SIMPLE_SCHEMA1 =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'>\n" +
        "  <group name='simple'>\n" +
        "    <sequence>\n" +
        "      <element name='name' type='string'/>\n" +
        "      <element name='age' type='int'/>\n" +
        "    </sequence>\n" +
        "  </group>\n" +
        "</schema>";
    
    public static final String GROUP_SIMPLE_SCHEMA2 =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'>\n" +
        "  <group name='simple'>\n" +
        "    <choice>\n" +
        "      <element name='name' type='string'/>\n" +
        "      <element name='age' type='int'/>\n" +
        "    </choice>\n" +
        "  </group>\n" +
        "</schema>";
    
    public static final String GROUP_SIMPLE_SCHEMA3 =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'>\n" +
        "  <group name='simple'>\n" +
        "    <all>\n" +
        "      <element name='name' type='string'/>\n" +
        "      <element name='age' type='int'/>\n" +
        "    </all>\n" +
        "  </group>\n" +
        "</schema>";
    
    public static final String ATTRIBUTEGROUP_SIMPLE_SCHEMA =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'>\n" +
        "  <attributeGroup name='simple'>\n" +
        "    <attribute name='male' use='required' type='boolean'/>\n" +
        "    <attribute name='registered' default='true' type='boolean'/>\n" +
        "  </attributeGroup>\n" +
        "</schema>";
    
    public static final String GROUP_REF_SCHEMA =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    xmlns:tns='urn:anything'" +
        "    elementFormDefault='qualified'>\n" +
        "  <group name='group'>\n" +
        "    <choice>\n" +
        "      <element name='name' type='string'/>\n" +
        "      <element name='age' type='int'/>\n" +
        "    </choice>\n" +
        "  </group>\n" +
        "  <complexType name='simple'>\n" +
        "    <sequence>\n" +
        "      <element name='real' type='boolean'/>\n" +
        "      <group ref='tns:group'/>\n" +
        "      <element name='local' type='string'/>\n" +
        "    </sequence>\n" +
        "  </complexType>\n" +
        "</schema>";
    
    public static final String ATTRIBUTEGROUP_REF_SCHEMA =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    xmlns:tns='urn:anything'" +
        "    elementFormDefault='qualified'>\n" +
        "  <attributeGroup name='group'>\n" +
        "    <attribute name='male' use='required' type='boolean'/>\n" +
        "    <attribute name='registered' default='true' type='boolean'/>\n" +
        "  </attributeGroup>\n" +
        "  <complexType name='simple'>\n" +
        "    <sequence>\n" +
        "      <element name='name' minOccurs='1' type='string'/>\n" +
        "      <element name='age' type='int'/>\n" +
        "    </sequence>\n" +
        "    <attributeGroup ref='tns:group'/>\n" +
        "  </complexType>\n" +
        "</schema>";
    
    public void testGroupEmpty() throws Exception {
        runNoErrors(GROUP_EMPTY_SCHEMA);
    }
    
    public void testAttributeGroupEmpty() throws Exception {
        runNoErrors(ATTRIBUTEGROUP_EMPTY_SCHEMA);
    }
    
    public void testGroupSimpleSchema1() throws Exception {
        runNoErrors(GROUP_SIMPLE_SCHEMA1);
    }
    
    public void testGroupSimpleSchema2() throws Exception {
        runNoErrors(GROUP_SIMPLE_SCHEMA2);
    }
    
    public void testGroupSimpleSchema3() throws Exception {
        runNoErrors(GROUP_SIMPLE_SCHEMA3);
    }
    
    public void testAttributeGroupSimple() throws Exception {
        runNoErrors(ATTRIBUTEGROUP_SIMPLE_SCHEMA);
    }
    
    public void testGroupRef() throws Exception {
        runNoErrors(GROUP_REF_SCHEMA);
    }
    
    public void testAttributeGroupRef() throws Exception {
        runNoErrors(ATTRIBUTEGROUP_REF_SCHEMA);
    }
}