Back to index

lightning-sunbird  0.9+nobinonly
nsISchema.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications.
00019  * Portions created by the Initial Developer are Copyright (C) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Vidur Apparao <vidur@netscape.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 #include "nsIWebServiceErrorHandler.idl"
00041 
00042 interface nsISchema;
00043 interface nsISchemaType;
00044 interface nsISchemaSimpleType;
00045 interface nsISchemaBuiltinType;
00046 interface nsISchemaListType;
00047 interface nsISchemaUnionType;
00048 interface nsISchemaRestrictionType;
00049 interface nsISchemaComplexType;
00050 interface nsISchemaParticle;
00051 interface nsISchemaModelGroup;
00052 interface nsISchemaAnyParticle;
00053 interface nsISchemaElement;
00054 interface nsISchemaAttributeComponent;
00055 interface nsISchemaAttribute;
00056 interface nsISchemaAttributeGroup;
00057 interface nsISchemaAnyAttribute;
00058 interface nsISchemaFacet;
00059 
00065 [scriptable, uuid(427c5511-941b-48c0-9abc-8ec9ea5d964b)]
00066 interface nsISchemaCollection : nsISupports {
00067   nsISchema getSchema(in AString targetNamespace);
00068   nsISchemaElement getElement(in AString name, in AString aNamespace);
00069   nsISchemaAttribute getAttribute(in AString name, in AString aNamespace);
00070   nsISchemaType getType(in AString name, in AString aNamespace);
00071 };
00072 
00073 [scriptable, uuid(5caaa64e-e191-11d8-842a-000393b6661a)]
00074 interface nsISchemaComponent : nsISupports {
00075   readonly attribute AString targetNamespace;
00076   void resolve(in nsIWebServiceErrorHandler aErrorHandler);
00077   void clear();
00078 };
00079 
00080 [scriptable, uuid(3c14a021-6f4e-11d5-9b46-000064657374)]
00081 interface nsISchema : nsISchemaComponent {
00082   /* Is this necessary? */
00083   readonly attribute AString schemaNamespace;
00084 
00085   readonly attribute PRUint32 typeCount;
00086   nsISchemaType getTypeByIndex(in PRUint32 index);
00087   nsISchemaType getTypeByName(in AString name);
00088 
00089   readonly attribute PRUint32 attributeCount;
00090   nsISchemaAttribute getAttributeByIndex(in PRUint32 index);
00091   nsISchemaAttribute getAttributeByName(in AString name);
00092 
00093   readonly attribute PRUint32 elementCount;
00094   nsISchemaElement getElementByIndex(in PRUint32 index);
00095   nsISchemaElement getElementByName(in AString name);
00096   
00097   readonly attribute PRUint32 attributeGroupCount;
00098   nsISchemaAttributeGroup getAttributeGroupByIndex(in PRUint32 index);
00099   nsISchemaAttributeGroup getAttributeGroupByName(in AString name);
00100 
00101   readonly attribute PRUint32 modelGroupCount;
00102   nsISchemaModelGroup getModelGroupByIndex(in PRUint32 index);
00103   nsISchemaModelGroup getModelGroupByName(in AString name);
00104 
00105   readonly attribute nsISchemaCollection collection;
00106 };
00107 
00108 [scriptable, uuid(3c14a022-6f4e-11d5-9b46-000064657374)]
00109 interface nsISchemaType : nsISchemaComponent {
00110   const unsigned short SCHEMA_TYPE_SIMPLE = 1;
00111   const unsigned short SCHEMA_TYPE_COMPLEX = 2;
00112   const unsigned short SCHEMA_TYPE_PLACEHOLDER = 3;
00113 
00114   readonly attribute AString name;
00115   readonly attribute unsigned short schemaType;
00116 };
00117 
00118 [scriptable, uuid(3c14a023-6f4e-11d5-9b46-000064657374)]
00119 interface nsISchemaSimpleType : nsISchemaType {
00120   const unsigned short SIMPLE_TYPE_BUILTIN = 1;
00121   const unsigned short SIMPLE_TYPE_LIST = 2;
00122   const unsigned short SIMPLE_TYPE_UNION = 3;
00123   const unsigned short SIMPLE_TYPE_RESTRICTION = 4;
00124 
00125   readonly attribute unsigned short simpleType;
00126 };
00127 
00128 [scriptable, uuid(3c14a024-6f4e-11d5-9b46-000064657374)]
00129 interface nsISchemaBuiltinType : nsISchemaSimpleType {
00130   const unsigned short BUILTIN_TYPE_ANYTYPE = 1;
00131   const unsigned short BUILTIN_TYPE_STRING = 2;
00132   const unsigned short BUILTIN_TYPE_NORMALIZED_STRING = 3;
00133   const unsigned short BUILTIN_TYPE_TOKEN = 4;
00134   const unsigned short BUILTIN_TYPE_BYTE = 5;
00135   const unsigned short BUILTIN_TYPE_UNSIGNEDBYTE = 6;
00136   const unsigned short BUILTIN_TYPE_BASE64BINARY = 7;
00137   const unsigned short BUILTIN_TYPE_HEXBINARY = 8;
00138   const unsigned short BUILTIN_TYPE_INTEGER = 9;
00139   const unsigned short BUILTIN_TYPE_POSITIVEINTEGER = 10;
00140   const unsigned short BUILTIN_TYPE_NEGATIVEINTEGER = 11;
00141   const unsigned short BUILTIN_TYPE_NONNEGATIVEINTEGER = 12;
00142   const unsigned short BUILTIN_TYPE_NONPOSITIVEINTEGER = 13;
00143   const unsigned short BUILTIN_TYPE_INT = 14;
00144   const unsigned short BUILTIN_TYPE_UNSIGNEDINT = 15;
00145   const unsigned short BUILTIN_TYPE_LONG = 16;
00146   const unsigned short BUILTIN_TYPE_UNSIGNEDLONG = 17;
00147   const unsigned short BUILTIN_TYPE_SHORT = 18;
00148   const unsigned short BUILTIN_TYPE_UNSIGNEDSHORT = 19;
00149   const unsigned short BUILTIN_TYPE_DECIMAL = 20;
00150   const unsigned short BUILTIN_TYPE_FLOAT = 21;
00151   const unsigned short BUILTIN_TYPE_DOUBLE = 22;
00152   const unsigned short BUILTIN_TYPE_BOOLEAN = 23;
00153   const unsigned short BUILTIN_TYPE_TIME = 24;
00154   const unsigned short BUILTIN_TYPE_DATETIME = 25;
00155   const unsigned short BUILTIN_TYPE_DURATION = 26;
00156   const unsigned short BUILTIN_TYPE_DATE = 27;
00157   const unsigned short BUILTIN_TYPE_GMONTH = 28;
00158   const unsigned short BUILTIN_TYPE_GYEAR = 29;
00159   const unsigned short BUILTIN_TYPE_GYEARMONTH = 30;
00160   const unsigned short BUILTIN_TYPE_GDAY = 31;
00161   const unsigned short BUILTIN_TYPE_GMONTHDAY = 32;
00162   const unsigned short BUILTIN_TYPE_NAME = 33;
00163   const unsigned short BUILTIN_TYPE_QNAME = 34;
00164   const unsigned short BUILTIN_TYPE_NCNAME = 35;
00165   const unsigned short BUILTIN_TYPE_ANYURI = 36;
00166   const unsigned short BUILTIN_TYPE_LANGUAGE = 37;
00167   const unsigned short BUILTIN_TYPE_ID = 38;
00168   const unsigned short BUILTIN_TYPE_IDREF = 39;
00169   const unsigned short BUILTIN_TYPE_IDREFS = 40;
00170   const unsigned short BUILTIN_TYPE_ENTITY = 41;
00171   const unsigned short BUILTIN_TYPE_ENTITIES = 42;
00172   const unsigned short BUILTIN_TYPE_NOTATION = 43;
00173   const unsigned short BUILTIN_TYPE_NMTOKEN = 44;
00174   const unsigned short BUILTIN_TYPE_NMTOKENS = 45;
00175 
00176   readonly attribute unsigned short builtinType;
00177 };
00178 
00179 [scriptable, uuid(3c14a025-6f4e-11d5-9b46-000064657374)]
00180 interface nsISchemaListType : nsISchemaSimpleType {
00181   readonly attribute nsISchemaSimpleType listType;
00182 };
00183 
00184 [scriptable, uuid(3c14a026-6f4e-11d5-9b46-000064657374)]
00185 interface nsISchemaUnionType : nsISchemaSimpleType {
00186   readonly attribute PRUint32 unionTypeCount;
00187   nsISchemaSimpleType getUnionType(in PRUint32 index);
00188 };
00189 
00190 [scriptable, uuid(3c14a027-6f4e-11d5-9b46-000064657374)]
00191 interface nsISchemaRestrictionType : nsISchemaSimpleType {
00192   readonly attribute nsISchemaSimpleType baseType;
00193   readonly attribute PRUint32 facetCount;
00194   nsISchemaFacet getFacet(in PRUint32 index);
00195 };
00196 
00197 [scriptable, uuid(3c14a028-6f4e-11d5-9b46-000064657374)]
00198 interface nsISchemaComplexType : nsISchemaType {
00199   const unsigned short CONTENT_MODEL_EMPTY = 1;
00200   const unsigned short CONTENT_MODEL_SIMPLE = 2;
00201   const unsigned short CONTENT_MODEL_ELEMENT_ONLY = 3;
00202   const unsigned short CONTENT_MODEL_MIXED = 4;
00203 
00204   const unsigned short DERIVATION_EXTENSION_SIMPLE = 1;
00205   const unsigned short DERIVATION_RESTRICTION_SIMPLE = 2;
00206   const unsigned short DERIVATION_EXTENSION_COMPLEX = 3;
00207   const unsigned short DERIVATION_RESTRICTION_COMPLEX = 4;  
00208   const unsigned short DERIVATION_SELF_CONTAINED = 5; // Restriction of ur-type
00209 
00210   readonly attribute unsigned short contentModel;
00211   readonly attribute unsigned short derivation;
00212   readonly attribute nsISchemaType baseType;
00213 
00214   // For complex types that are derivations of simple types or of
00215   // complex types that are themselves derivations of simple types
00216   // i.e. derivation is either DERIVATION_RESTRICTION_SIMPLE or
00217   // DERIVATION_EXTENSION_SIMPLE.
00218   readonly attribute nsISchemaSimpleType simpleBaseType; 
00219 
00220   readonly attribute nsISchemaModelGroup modelGroup;
00221   
00222   readonly attribute PRUint32 attributeCount;
00223   nsISchemaAttributeComponent getAttributeByIndex(in PRUint32 index);
00224   nsISchemaAttributeComponent getAttributeByName(in AString name);
00225 
00226   readonly attribute boolean abstract;
00227   
00228   readonly attribute boolean isArray;
00229   readonly attribute nsISchemaType arrayType;
00230   readonly attribute PRUint32 arrayDimension;
00231 };
00232 
00233 [scriptable, uuid(3c14a029-6f4e-11d5-9b46-000064657374)]
00234 interface nsISchemaParticle : nsISchemaComponent {
00235   const unsigned short PARTICLE_TYPE_ELEMENT = 1;
00236   const unsigned short PARTICLE_TYPE_MODEL_GROUP = 2;
00237   const unsigned short PARTICLE_TYPE_ANY = 3;
00238 
00239   const PRUint32 OCCURRENCE_UNBOUNDED = 0xFFFFFFFF;
00240 
00241   readonly attribute AString name;
00242   readonly attribute unsigned short particleType;
00243 
00244   readonly attribute PRUint32 minOccurs;
00245   readonly attribute PRUint32 maxOccurs;  
00246 };
00247 
00248 [scriptable, uuid(3c14a02a-6f4e-11d5-9b46-000064657374)]
00249 interface nsISchemaModelGroup : nsISchemaParticle {
00250   const unsigned short COMPOSITOR_ALL = 1;
00251   const unsigned short COMPOSITOR_SEQUENCE = 2;
00252   const unsigned short COMPOSITOR_CHOICE = 3;
00253 
00254   readonly attribute unsigned short compositor;
00255 
00256   readonly attribute PRUint32 particleCount;
00257   nsISchemaParticle getParticle(in PRUint32 index);
00258 
00259   // Get named element definition for a named element that is
00260   // part of this model group or part of a nested model group.
00261   nsISchemaElement getElementByName(in AString name);
00262 };
00263 
00264 [scriptable, uuid(3c14a02b-6f4e-11d5-9b46-000064657374)]
00265 interface nsISchemaAnyParticle : nsISchemaParticle {
00266   const unsigned short PROCESS_STRICT = 1;
00267   const unsigned short PROCESS_SKIP = 2;
00268   const unsigned short PROCESS_LAX = 3;
00269 
00270   readonly attribute unsigned short process;
00271   readonly attribute AString namespace;
00272 };
00273 
00274 [scriptable, uuid(3c14a02c-6f4e-11d5-9b46-000064657374)]
00275 interface nsISchemaElement : nsISchemaParticle {
00276   readonly attribute nsISchemaType type;
00277 
00278   readonly attribute AString defaultValue;
00279   readonly attribute AString fixedValue;
00280 
00281   readonly attribute boolean nillable;
00282   readonly attribute boolean abstract; 
00283 };
00284 
00285 [scriptable, uuid(3c14a02d-6f4e-11d5-9b46-000064657374)]
00286 interface nsISchemaAttributeComponent : nsISchemaComponent {
00287   const unsigned short COMPONENT_TYPE_ATTRIBUTE = 1;
00288   const unsigned short COMPONENT_TYPE_GROUP = 2;
00289   const unsigned short COMPONENT_TYPE_ANY = 3;
00290   
00291   readonly attribute AString name;
00292   readonly attribute unsigned short componentType;
00293 };
00294 
00295 [scriptable, uuid(3c14a02e-6f4e-11d5-9b46-000064657374)]
00296 interface nsISchemaAttribute : nsISchemaAttributeComponent {
00297   const unsigned short USE_OPTIONAL = 1;
00298   const unsigned short USE_PROHIBITED = 2;
00299   const unsigned short USE_REQUIRED = 3;
00300 
00301   readonly attribute nsISchemaSimpleType type;
00302  
00303   readonly attribute AString defaultValue;
00304   readonly attribute AString fixedValue;
00305   readonly attribute unsigned short use;
00306 };
00307 
00308 [scriptable, uuid(3c14a02f-6f4e-11d5-9b46-000064657374)]
00309 interface nsISchemaAttributeGroup : nsISchemaAttributeComponent {
00310   readonly attribute PRUint32 attributeCount;
00311   nsISchemaAttributeComponent getAttributeByIndex(in PRUint32 index);
00312   nsISchemaAttributeComponent getAttributeByName(in AString name);
00313 };
00314 
00315 [scriptable, uuid(3c14a030-6f4e-11d5-9b46-000064657374)]
00316 interface nsISchemaAnyAttribute : nsISchemaAttributeComponent {
00317   const unsigned short PROCESS_STRICT = 1;
00318   const unsigned short PROCESS_SKIP = 2;
00319   const unsigned short PROCESS_LAX = 3;
00320 
00321   readonly attribute unsigned short process;
00322   readonly attribute AString namespace;
00323 };
00324 
00325 [scriptable, uuid(3c14a031-6f4e-11d5-9b46-000064657374)]
00326 interface nsISchemaFacet : nsISchemaComponent {
00327   const unsigned short FACET_TYPE_LENGTH = 1;
00328   const unsigned short FACET_TYPE_MINLENGTH = 2;
00329   const unsigned short FACET_TYPE_MAXLENGTH = 3;
00330   const unsigned short FACET_TYPE_PATTERN = 4;
00331   const unsigned short FACET_TYPE_ENUMERATION = 5;
00332   const unsigned short FACET_TYPE_WHITESPACE = 6;
00333   const unsigned short FACET_TYPE_MAXINCLUSIVE = 7;
00334   const unsigned short FACET_TYPE_MININCLUSIVE = 8;
00335   const unsigned short FACET_TYPE_MAXEXCLUSIVE = 9;
00336   const unsigned short FACET_TYPE_MINEXCLUSIVE = 10;
00337   const unsigned short FACET_TYPE_TOTALDIGITS = 11;
00338   const unsigned short FACET_TYPE_FRACTIONDIGITS = 12;
00339   
00340   const unsigned short WHITESPACE_PRESERVE = 1;
00341   const unsigned short WHITESPACE_REPLACE = 1;
00342   const unsigned short WHITESPACE_COLLAPSE = 1;
00343   
00344 
00345   readonly attribute unsigned short facetType;
00346   readonly attribute AString value;
00347   readonly attribute PRUint32 lengthValue; // For length, minLength & maxLength
00348   readonly attribute PRUint32 digitsValue; // For totalDigits & fractionDigits
00349   readonly attribute unsigned short whitespaceValue; // For whitespace only
00350   readonly attribute boolean isfixed;
00351 };