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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
%%% The contents of this file are subject to the Erlang Public License,
%%% Version 1.0, (the "License"); you may not use this file except in
%%% compliance with the License. You may obtain a copy of the License at
%%% http://www.erlang.org/license/EPL1_0.txt
%%%
%%% Software distributed under the License is distributed on an "AS IS"
%%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%%% the License for the specific language governing rights and limitations
%%% under the License.
%%%
%%%
%%% The Initial Developer of the Original Code is Ericsson Telecom
%%% AB. Portions created by Ericsson are Copyright (C), 1998, Ericsson
%%% Telecom AB. All Rights Reserved.
%%%-------------------------------------------------------------------
%%% File : xmerl_xsd.hrl
%%% Author : Bertil Karlsson <bertil@finrod>
%%% Description :
%%%
%%% Created : 20 Jan 2006 by Bertil Karlsson <bertil@finrod>
%%%-------------------------------------------------------------------
%%-define(DEBUG,ok).
-ifdef(DEBUG).
-define(debug(_Fmt_,_Args_),ok=io:format("~p: " ++ _Fmt_, [?LINE|_Args_])).
-else.
-define(debug(_Fmt_,_Args_),no_debug).
-endif.
-define(XSD_NAMESPACE,'http://www.w3.org/2001/XMLSchema').
-define(XSD_INSTANCE_NAMESPACE,'http://www.w3.org/2001/XMLSchema-instance').
-record(xsd_state,{
schema_name,
vsn,
schema_preprocessed=false,
external_xsd_base=false,
xsd_base,
xml_options=[],
scope=[],
schemaLocations=[],
elementFormDefault=unqualified,
attributeFormDefault=unqualified,
localElementsNamespace,
targetNamespace,
namespace_nodes=[{"xml",'http://www.w3.org/XML/1998/namespace'}],
global_namespace_nodes=[],
checked_namespace_nodes=[{"xml",[],'http://www.w3.org/XML/1998/namespace'}],
table,
tab2file=false, %% for debuging of abstract syntax
redefine=false,
finalDefault, %% undefined | '#all' | [atom()]
%% atom() -> extension |
%% restriction | list | union
blockDefault,
fetch_fun,
fetch_path=[],
num_el=0,
global_element_source=[],
keyrefs=[],
'IDs'=[],
substitutionGroups=[],
derived_types=[],
unchecked_references=[],
circularity_stack=[],
circularity_disallowed=[],
errors=[]
}).
-record(schema,{
elementFormDefault,
attributeFormDefault,
targetNamespace,
blockDefault=[],
finalDefault=[],
id,
content=[]
}).
-record(schema_element,{
name, %% QName
type, %% name of derived type or built-in type
resolved=false,
substitutionGroup,
uniqueness, %% list() initiates in element_content for element
key, %% list() initiates in element_content for element
scope,
form, %% unqualified | qualified
id,
occurance={1,1}, %% {minOccurs,maxOccurs}
value_constraint, %% undefined | {default,Value} | {fixed,Value}
nillable=false, %% true | false
abstract=false, %% true | false
block=[],
final=[]
}).
-record(schema_simple_type,{
name,
scope,
base_type,
resolved=false,
final=[],
id,
facets=[],
variety=atomic, %% atomic | list | union
content
}).
-record(schema_complex_type,{
name,
base_type,
resolved=false,
scope,
derivation,
final=[], %% controls derivation by types
id,
block=[], %% prevents using of derived types in instance
%% mixed=false,
abstract=false,
content_type='element-only',%% mixed | 'element-only'
complexity, %% undefined | simple | complex
attributes=[],
content=[],
prohibited
}).
-record(schema_attribute,{
name,
type,
resolved=false,
scope,
%% required=false,
use=optional, %% optional | required | prohibited
default,
fixed,
form, %% qualified | unqualified
id
}).
-record(schema_attribute_group,{
name,
id,
ref, %% in this case no name or content
content=[]
}).
-record(schema_anyAttribute,{
id,
processContents = strict,
namespace,
scope
}).
-record(schema_group,{
name,
id,
ref, %% in this case no name or content
content=[],
occurance={1,1}
}).
-record(schema_extension,{
base,
id,
content=[]
}).
-record(schema_restriction,{
base,
id,
content=[]
}).
-record(schema_list,{
id,
itemType
}).
-record(id_constraint,{
category,% unique | key | keyref
id,
name,
refer, % only if type is keyref
type, %% This must be a simple type. Obtained by the
%% selector/fields
selector,
fields, %% list()
key_sequence
}).
%% content model records, used in the static structure of what is
%% allowed for a schema.
%% chain, represents a series of ordered objects, some of whom may be
%% optional.
%% alterantive, a collection of objects of which only one is chosen.
-record(chain,{
content,
occurance={1,1}
}).
-record(alternative,{
content,
occurance={0,1}
}).
|