1%%% Licensed under the Apache License, Version 2.0 (the "License"); 2%%% you may not use this file except in compliance with the License. 3%%% You may obtain a copy of the License at 4%%% 5%%% http://www.apache.org/licenses/LICENSE-2.0 6%%% 7%%% Unless required by applicable law or agreed to in writing, software 8%%% distributed under the License is distributed on an "AS IS" BASIS, 9%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10%%% See the License for the specific language governing permissions and 11%%% limitations under the License. 12%%% 13%%% 14%%% The Initial Developer of the Original Code is Ericsson Telecom 15%%% AB. Portions created by Ericsson are Copyright (C), 1998, Ericsson 16%%% Telecom AB. All Rights Reserved. 17%%%------------------------------------------------------------------- 18 19%%% File : xmerl_xsd.hrl 20%%% Author : Bertil Karlsson <bertil@finrod> 21%%% Description : 22%%% 23%%% Created : 20 Jan 2006 by Bertil Karlsson <bertil@finrod> 24%%%------------------------------------------------------------------- 25 26%%-define(DEBUG,ok). 27 28-ifdef(DEBUG). 29-define(debug(_Fmt_,_Args_),ok=io:format("~p: " ++ _Fmt_, [?LINE|_Args_])). 30-else. 31-define(debug(_Fmt_,_Args_),no_debug). 32-endif. 33 34-define(XSD_NAMESPACE,'http://www.w3.org/2001/XMLSchema'). 35-define(XSD_INSTANCE_NAMESPACE,'http://www.w3.org/2001/XMLSchema-instance'). 36 37-record(xsd_state,{ 38 schema_name, 39 vsn, 40 schema_preprocessed=false, 41 external_xsd_base=false, 42 xsd_base, 43 xml_options=[], 44 scope=[], 45 schemaLocations=[], 46 elementFormDefault=unqualified, 47 attributeFormDefault=unqualified, 48 localElementsNamespace, 49 targetNamespace, 50 namespace_nodes=[{"xml",'http://www.w3.org/XML/1998/namespace'}], 51 global_namespace_nodes=[], 52 checked_namespace_nodes=[{"xml",[],'http://www.w3.org/XML/1998/namespace'}], 53 table, 54 tab2file=false, %% for debuging of abstract syntax 55 redefine=false, 56 finalDefault, %% undefined | '#all' | [atom()] 57 %% atom() -> extension | 58 %% restriction | list | union 59 blockDefault, 60 fetch_fun, 61 fetch_path=[], 62 num_el=0, 63 global_element_source=[], 64 keyrefs=[], 65 'IDs'=[], 66 substitutionGroups=[], 67 derived_types=[], 68 unchecked_references=[], 69 circularity_stack=[], 70 circularity_disallowed=[], 71 errors=[] 72 }). 73-record(schema,{ 74 elementFormDefault, 75 attributeFormDefault, 76 targetNamespace, 77 blockDefault=[], 78 finalDefault=[], 79 id, 80 content=[] 81 }). 82-record(schema_element,{ 83 name, %% QName 84 type, %% name of derived type or built-in type 85 resolved=false, 86 substitutionGroup, 87 uniqueness, %% list() initiates in element_content for element 88 key, %% list() initiates in element_content for element 89 scope, 90 form, %% unqualified | qualified 91 id, 92 occurance={1,1}, %% {minOccurs,maxOccurs} 93 value_constraint, %% undefined | {default,Value} | {fixed,Value} 94 nillable=false, %% true | false 95 abstract=false, %% true | false 96 block=[], 97 final=[] 98 }). 99-record(schema_simple_type,{ 100 name, 101 scope, 102 base_type, 103 resolved=false, 104 final=[], 105 id, 106 facets=[], 107 variety=atomic, %% atomic | list | union 108 content 109 }). 110-record(schema_complex_type,{ 111 name, 112 base_type, 113 resolved=false, 114 scope, 115 derivation, 116 final=[], %% controls derivation by types 117 id, 118 block=[], %% prevents using of derived types in instance 119%% mixed=false, 120 abstract=false, 121 content_type='element-only',%% mixed | 'element-only' 122 complexity, %% undefined | simple | complex 123 attributes=[], 124 content=[], 125 prohibited 126 }). 127-record(schema_attribute,{ 128 name, 129 type, 130 resolved=false, 131 scope, 132%% required=false, 133 use=optional, %% optional | required | prohibited 134 default, 135 fixed, 136 form, %% qualified | unqualified 137 id 138 }). 139-record(schema_attribute_group,{ 140 name, 141 id, 142 ref, %% in this case no name or content 143 content=[] 144 }). 145-record(schema_anyAttribute,{ 146 id, 147 processContents = strict, 148 namespace, 149 scope 150 }). 151-record(schema_group,{ 152 name, 153 id, 154 ref, %% in this case no name or content 155 content=[], 156 occurance={1,1} 157 }). 158-record(schema_extension,{ 159 base, 160 id, 161 content=[] 162 }). 163-record(schema_restriction,{ 164 base, 165 id, 166 content=[] 167 }). 168-record(schema_list,{ 169 id, 170 itemType 171 }). 172-record(id_constraint,{ 173 category,% unique | key | keyref 174 id, 175 name, 176 refer, % only if type is keyref 177 type, %% This must be a simple type. Obtained by the 178 %% selector/fields 179 selector, 180 fields, %% list() 181 key_sequence 182 }). 183 184 185%% content model records, used in the static structure of what is 186%% allowed for a schema. 187%% chain, represents a series of ordered objects, some of whom may be 188%% optional. 189%% alterantive, a collection of objects of which only one is chosen. 190-record(chain,{ 191 content, 192 occurance={1,1} 193 }). 194-record(alternative,{ 195 content, 196 occurance={0,1} 197 }). 198