Import 3.0 beta 3 tarball
[mozilla-extra.git] / extensions / schema-validation / public / nsISVSchema.idl
blob09021aab8da47bcb6e0a488ca50d13eae11407ce
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications.
19 * Portions created by the Initial Developer are Copyright (C) 2001
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Vidur Apparao <vidur@netscape.com> (original author)
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include "nsISupports.idl"
40 #include "nsIWebServiceErrorHandler.idl"
42 interface nsISchema;
43 interface nsISchemaType;
44 interface nsISchemaSimpleType;
45 interface nsISchemaBuiltinType;
46 interface nsISchemaListType;
47 interface nsISchemaUnionType;
48 interface nsISchemaRestrictionType;
49 interface nsISchemaComplexType;
50 interface nsISchemaParticle;
51 interface nsISchemaModelGroup;
52 interface nsISchemaAnyParticle;
53 interface nsISchemaElement;
54 interface nsISchemaAttributeComponent;
55 interface nsISchemaAttribute;
56 interface nsISchemaAttributeGroup;
57 interface nsISchemaAnyAttribute;
58 interface nsISchemaFacet;
60 /**
61 * The collection of loaded schemas. If a schema references other
62 * schemas (generally through an import), these will be included
63 * in the corresponding collection.
65 [scriptable, uuid(427c5511-941b-48c0-9abc-8ec9ea5d964b)]
66 interface nsISchemaCollection : nsISupports {
67 nsISchema getSchema(in AString targetNamespace);
68 nsISchemaElement getElement(in AString name, in AString aNamespace);
69 nsISchemaAttribute getAttribute(in AString name, in AString aNamespace);
70 nsISchemaType getType(in AString name, in AString aNamespace);
73 [scriptable, uuid(5caaa64e-e191-11d8-842a-000393b6661a)]
74 interface nsISchemaComponent : nsISupports {
75 readonly attribute AString targetNamespace;
76 void resolve(in nsIWebServiceErrorHandler aErrorHandler);
77 void clear();
80 [scriptable, uuid(236ce1d7-213e-42e7-96ad-79f4cb3282a9)]
81 interface nsISchema : nsISchemaComponent {
82 /* Is this necessary? */
83 readonly attribute AString schemaNamespace;
85 readonly attribute PRUint32 typeCount;
86 nsISchemaType getTypeByIndex(in PRUint32 index);
87 nsISchemaType getTypeByName(in AString name);
89 readonly attribute PRUint32 attributeCount;
90 nsISchemaAttribute getAttributeByIndex(in PRUint32 index);
91 nsISchemaAttribute getAttributeByName(in AString name);
93 readonly attribute PRUint32 elementCount;
94 nsISchemaElement getElementByIndex(in PRUint32 index);
95 nsISchemaElement getElementByName(in AString name);
97 readonly attribute PRUint32 attributeGroupCount;
98 nsISchemaAttributeGroup getAttributeGroupByIndex(in PRUint32 index);
99 nsISchemaAttributeGroup getAttributeGroupByName(in AString name);
101 readonly attribute PRUint32 modelGroupCount;
102 nsISchemaModelGroup getModelGroupByIndex(in PRUint32 index);
103 nsISchemaModelGroup getModelGroupByName(in AString name);
105 readonly attribute nsISchemaCollection collection;
108 [scriptable, uuid(3c14a022-6f4e-11d5-9b46-000064657374)]
109 interface nsISchemaType : nsISchemaComponent {
110 const unsigned short SCHEMA_TYPE_SIMPLE = 1;
111 const unsigned short SCHEMA_TYPE_COMPLEX = 2;
112 const unsigned short SCHEMA_TYPE_PLACEHOLDER = 3;
114 readonly attribute AString name;
115 readonly attribute unsigned short schemaType;
118 [scriptable, uuid(3c14a023-6f4e-11d5-9b46-000064657374)]
119 interface nsISchemaSimpleType : nsISchemaType {
120 const unsigned short SIMPLE_TYPE_BUILTIN = 1;
121 const unsigned short SIMPLE_TYPE_LIST = 2;
122 const unsigned short SIMPLE_TYPE_UNION = 3;
123 const unsigned short SIMPLE_TYPE_RESTRICTION = 4;
125 readonly attribute unsigned short simpleType;
128 [scriptable, uuid(3c14a024-6f4e-11d5-9b46-000064657374)]
129 interface nsISchemaBuiltinType : nsISchemaSimpleType {
130 const unsigned short BUILTIN_TYPE_ANYTYPE = 1;
131 const unsigned short BUILTIN_TYPE_STRING = 2;
132 const unsigned short BUILTIN_TYPE_NORMALIZED_STRING = 3;
133 const unsigned short BUILTIN_TYPE_TOKEN = 4;
134 const unsigned short BUILTIN_TYPE_BYTE = 5;
135 const unsigned short BUILTIN_TYPE_UNSIGNEDBYTE = 6;
136 const unsigned short BUILTIN_TYPE_BASE64BINARY = 7;
137 const unsigned short BUILTIN_TYPE_HEXBINARY = 8;
138 const unsigned short BUILTIN_TYPE_INTEGER = 9;
139 const unsigned short BUILTIN_TYPE_POSITIVEINTEGER = 10;
140 const unsigned short BUILTIN_TYPE_NEGATIVEINTEGER = 11;
141 const unsigned short BUILTIN_TYPE_NONNEGATIVEINTEGER = 12;
142 const unsigned short BUILTIN_TYPE_NONPOSITIVEINTEGER = 13;
143 const unsigned short BUILTIN_TYPE_INT = 14;
144 const unsigned short BUILTIN_TYPE_UNSIGNEDINT = 15;
145 const unsigned short BUILTIN_TYPE_LONG = 16;
146 const unsigned short BUILTIN_TYPE_UNSIGNEDLONG = 17;
147 const unsigned short BUILTIN_TYPE_SHORT = 18;
148 const unsigned short BUILTIN_TYPE_UNSIGNEDSHORT = 19;
149 const unsigned short BUILTIN_TYPE_DECIMAL = 20;
150 const unsigned short BUILTIN_TYPE_FLOAT = 21;
151 const unsigned short BUILTIN_TYPE_DOUBLE = 22;
152 const unsigned short BUILTIN_TYPE_BOOLEAN = 23;
153 const unsigned short BUILTIN_TYPE_TIME = 24;
154 const unsigned short BUILTIN_TYPE_DATETIME = 25;
155 const unsigned short BUILTIN_TYPE_DURATION = 26;
156 const unsigned short BUILTIN_TYPE_DATE = 27;
157 const unsigned short BUILTIN_TYPE_GMONTH = 28;
158 const unsigned short BUILTIN_TYPE_GYEAR = 29;
159 const unsigned short BUILTIN_TYPE_GYEARMONTH = 30;
160 const unsigned short BUILTIN_TYPE_GDAY = 31;
161 const unsigned short BUILTIN_TYPE_GMONTHDAY = 32;
162 const unsigned short BUILTIN_TYPE_NAME = 33;
163 const unsigned short BUILTIN_TYPE_QNAME = 34;
164 const unsigned short BUILTIN_TYPE_NCNAME = 35;
165 const unsigned short BUILTIN_TYPE_ANYURI = 36;
166 const unsigned short BUILTIN_TYPE_LANGUAGE = 37;
167 const unsigned short BUILTIN_TYPE_ID = 38;
168 const unsigned short BUILTIN_TYPE_IDREF = 39;
169 const unsigned short BUILTIN_TYPE_IDREFS = 40;
170 const unsigned short BUILTIN_TYPE_ENTITY = 41;
171 const unsigned short BUILTIN_TYPE_ENTITIES = 42;
172 const unsigned short BUILTIN_TYPE_NOTATION = 43;
173 const unsigned short BUILTIN_TYPE_NMTOKEN = 44;
174 const unsigned short BUILTIN_TYPE_NMTOKENS = 45;
176 readonly attribute unsigned short builtinType;
179 [scriptable, uuid(3c14a025-6f4e-11d5-9b46-000064657374)]
180 interface nsISchemaListType : nsISchemaSimpleType {
181 readonly attribute nsISchemaSimpleType listType;
184 [scriptable, uuid(3c14a026-6f4e-11d5-9b46-000064657374)]
185 interface nsISchemaUnionType : nsISchemaSimpleType {
186 readonly attribute PRUint32 unionTypeCount;
187 nsISchemaSimpleType getUnionType(in PRUint32 index);
190 [scriptable, uuid(3c14a027-6f4e-11d5-9b46-000064657374)]
191 interface nsISchemaRestrictionType : nsISchemaSimpleType {
192 readonly attribute nsISchemaSimpleType baseType;
193 readonly attribute PRUint32 facetCount;
194 nsISchemaFacet getFacet(in PRUint32 index);
197 [scriptable, uuid(3c14a028-6f4e-11d5-9b46-000064657374)]
198 interface nsISchemaComplexType : nsISchemaType {
199 const unsigned short CONTENT_MODEL_EMPTY = 1;
200 const unsigned short CONTENT_MODEL_SIMPLE = 2;
201 const unsigned short CONTENT_MODEL_ELEMENT_ONLY = 3;
202 const unsigned short CONTENT_MODEL_MIXED = 4;
204 const unsigned short DERIVATION_EXTENSION_SIMPLE = 1;
205 const unsigned short DERIVATION_RESTRICTION_SIMPLE = 2;
206 const unsigned short DERIVATION_EXTENSION_COMPLEX = 3;
207 const unsigned short DERIVATION_RESTRICTION_COMPLEX = 4;
208 const unsigned short DERIVATION_SELF_CONTAINED = 5; // Restriction of ur-type
210 readonly attribute unsigned short contentModel;
211 readonly attribute unsigned short derivation;
212 readonly attribute nsISchemaType baseType;
214 // For complex types that are derivations of simple types or of
215 // complex types that are themselves derivations of simple types
216 // i.e. derivation is either DERIVATION_RESTRICTION_SIMPLE or
217 // DERIVATION_EXTENSION_SIMPLE.
218 readonly attribute nsISchemaSimpleType simpleBaseType;
220 readonly attribute nsISchemaModelGroup modelGroup;
222 readonly attribute PRUint32 attributeCount;
223 nsISchemaAttributeComponent getAttributeByIndex(in PRUint32 index);
224 nsISchemaAttributeComponent getAttributeByName(in AString name);
226 readonly attribute boolean abstract;
228 readonly attribute boolean isArray;
229 readonly attribute nsISchemaType arrayType;
230 readonly attribute PRUint32 arrayDimension;
233 [scriptable, uuid(3c14a029-6f4e-11d5-9b46-000064657374)]
234 interface nsISchemaParticle : nsISchemaComponent {
235 const unsigned short PARTICLE_TYPE_ELEMENT = 1;
236 const unsigned short PARTICLE_TYPE_MODEL_GROUP = 2;
237 const unsigned short PARTICLE_TYPE_ANY = 3;
239 const PRUint32 OCCURRENCE_UNBOUNDED = 0xFFFFFFFF;
241 readonly attribute AString name;
242 readonly attribute unsigned short particleType;
244 readonly attribute PRUint32 minOccurs;
245 readonly attribute PRUint32 maxOccurs;
248 [scriptable, uuid(3c14a02a-6f4e-11d5-9b46-000064657374)]
249 interface nsISchemaModelGroup : nsISchemaParticle {
250 const unsigned short COMPOSITOR_ALL = 1;
251 const unsigned short COMPOSITOR_SEQUENCE = 2;
252 const unsigned short COMPOSITOR_CHOICE = 3;
254 readonly attribute unsigned short compositor;
256 readonly attribute PRUint32 particleCount;
257 nsISchemaParticle getParticle(in PRUint32 index);
259 // Get named element definition for a named element that is
260 // part of this model group or part of a nested model group.
261 nsISchemaElement getElementByName(in AString name);
264 [scriptable, uuid(3c14a02b-6f4e-11d5-9b46-000064657374)]
265 interface nsISchemaAnyParticle : nsISchemaParticle {
266 const unsigned short PROCESS_STRICT = 1;
267 const unsigned short PROCESS_SKIP = 2;
268 const unsigned short PROCESS_LAX = 3;
270 readonly attribute unsigned short process;
271 readonly attribute AString namespace;
274 [scriptable, uuid(3c14a02c-6f4e-11d5-9b46-000064657374)]
275 interface nsISchemaElement : nsISchemaParticle {
276 readonly attribute nsISchemaType type;
278 readonly attribute AString defaultValue;
279 readonly attribute AString fixedValue;
281 readonly attribute boolean nillable;
282 readonly attribute boolean abstract;
285 [scriptable, uuid(3c14a02d-6f4e-11d5-9b46-000064657374)]
286 interface nsISchemaAttributeComponent : nsISchemaComponent {
287 const unsigned short COMPONENT_TYPE_ATTRIBUTE = 1;
288 const unsigned short COMPONENT_TYPE_GROUP = 2;
289 const unsigned short COMPONENT_TYPE_ANY = 3;
291 readonly attribute AString name;
292 readonly attribute unsigned short componentType;
295 [scriptable, uuid(47241e70-ca2c-4372-a6b2-5c84d32cc739)]
296 interface nsISchemaAttribute : nsISchemaAttributeComponent {
297 const unsigned short USE_OPTIONAL = 1;
298 const unsigned short USE_PROHIBITED = 2;
299 const unsigned short USE_REQUIRED = 3;
301 readonly attribute nsISchemaSimpleType type;
303 readonly attribute AString defaultValue;
304 readonly attribute AString fixedValue;
305 readonly attribute unsigned short use;
307 readonly attribute AString qualifiedNamespace;
310 [scriptable, uuid(3c14a02f-6f4e-11d5-9b46-000064657374)]
311 interface nsISchemaAttributeGroup : nsISchemaAttributeComponent {
312 readonly attribute PRUint32 attributeCount;
313 nsISchemaAttributeComponent getAttributeByIndex(in PRUint32 index);
314 nsISchemaAttributeComponent getAttributeByName(in AString name);
317 [scriptable, uuid(3c14a030-6f4e-11d5-9b46-000064657374)]
318 interface nsISchemaAnyAttribute : nsISchemaAttributeComponent {
319 const unsigned short PROCESS_STRICT = 1;
320 const unsigned short PROCESS_SKIP = 2;
321 const unsigned short PROCESS_LAX = 3;
323 readonly attribute unsigned short process;
324 readonly attribute AString namespace;
327 [scriptable, uuid(3c14a031-6f4e-11d5-9b46-000064657374)]
328 interface nsISchemaFacet : nsISchemaComponent {
329 const unsigned short FACET_TYPE_LENGTH = 1;
330 const unsigned short FACET_TYPE_MINLENGTH = 2;
331 const unsigned short FACET_TYPE_MAXLENGTH = 3;
332 const unsigned short FACET_TYPE_PATTERN = 4;
333 const unsigned short FACET_TYPE_ENUMERATION = 5;
334 const unsigned short FACET_TYPE_WHITESPACE = 6;
335 const unsigned short FACET_TYPE_MAXINCLUSIVE = 7;
336 const unsigned short FACET_TYPE_MININCLUSIVE = 8;
337 const unsigned short FACET_TYPE_MAXEXCLUSIVE = 9;
338 const unsigned short FACET_TYPE_MINEXCLUSIVE = 10;
339 const unsigned short FACET_TYPE_TOTALDIGITS = 11;
340 const unsigned short FACET_TYPE_FRACTIONDIGITS = 12;
342 const unsigned short WHITESPACE_PRESERVE = 1;
343 const unsigned short WHITESPACE_REPLACE = 1;
344 const unsigned short WHITESPACE_COLLAPSE = 1;
347 readonly attribute unsigned short facetType;
348 readonly attribute AString value;
349 readonly attribute PRUint32 lengthValue; // For length, minLength & maxLength
350 readonly attribute PRUint32 digitsValue; // For totalDigits & fractionDigits
351 readonly attribute unsigned short whitespaceValue; // For whitespace only
352 readonly attribute boolean isfixed;