summaryrefslogtreecommitdiffstats
path: root/gxml/Schema.vala
blob: c64731c854de32bb6fdd0e1f937e1a0067d83c12 (plain)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 *
 * Copyright (C) 2017  Daniel Espinosa <esodan@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */
using GXml;

/**
 * Reference interfaces for XSD support.
 */
public interface GXml.IXsdSchema : GLib.Object, DomElement {
  public const string SCHEMA_NODE_NAME = "schema";
  public const string SCHEMA_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";
  public const string SCHEMA_NAMESPACE_PREFIX = "xs";
  public abstract IXsdListElements element_definitions { get; set; }
  public abstract IXsdListSimpleTypes simple_type_definitions { get; set; }
  public abstract IXsdListComplexTypes complex_type_definitions { get; set; }
}

/**
 * XSD schema Error codes for {@link IXsdSchema} objects
 */
public errordomain GXml.IXsdSchemaError {
  INVALIDATION_ERROR
}

public interface GXml.IXsdBaseType : Object {
  public abstract IXsdAnnotation anotation { get; set; }
}

public interface GXml.IXsdSimpleType: Object, DomElement, IXsdBaseType {
  public const string SCHEMA_NODE_NAME = "simpleType";
  /**
   * (#all | List of (list | union | restriction | extension))
   */
  public abstract string final { get; set; }
  public abstract string id { get; set; }
  public abstract string name { get; set; }
  public abstract IXsdAnnotation annotation { get; set; }
  public abstract IXsdTypeList list { get; set; }
  public abstract IXsdTypeUnion union { get; set; }
  public abstract IXsdTypeRestriction restriction { get; set; }
}
public interface GXml.IXsdTypeDef : Object {}
public interface GXml.IXsdTypeRestriction : Object, IXsdTypeDef {
  public const string SCHEMA_NODE_NAME = "restriction";
  public abstract string base { get; set; }
  public abstract string id { get; set; }
  public abstract IXsdSimpleType simple_type { get; set; }
  // TODO: Add all other definitons: like MinExclusive and others
  public abstract IXsdListTypeRestrictionEnumerations enumerations { get; set; }
  public abstract IXsdListTypeRestrictionWhiteSpaces white_spaces { get; set; }
}
public interface GXml.IXsdTypeList: Object, IXsdTypeDef {}
public interface GXml.IXsdTypeUnion : Object, IXsdTypeDef {}

public interface GXml.IXsdTypeRestrictionDef : Object {
  public abstract IXsdAnnotation annotation { get; set; }
}
public interface GXml.IXsdTypeRestrictionMinExclusive : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionMinInclusive : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionMaxExclusive : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionMaxInclusive : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionTotalDigits : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionFractionDigits : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionLength : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionMinLength : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionMaxLength : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionEnumeration : Object, IXsdTypeRestrictionDef {
  public const string SCHEMA_NODE_NAME = "enumeration";
  public abstract string id { get; set; }
  public abstract string value { get; set; }
}
public interface GXml.IXsdTypeRestrictionWhiteSpace: Object, IXsdTypeRestrictionDef {
  public const string SCHEMA_NODE_NAME = "whiteSpace";
  public abstract bool fixed { get; set; default = false; }
  public abstract string id { get; set; }
  /**
   * (collapse | preserve | replace)
   */
  public abstract string value { get; set; }
}
public interface GXml.IXsdTypeRestrictionPattern : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionAssertion : Object, IXsdTypeRestrictionDef {}
public interface GXml.IXsdTypeRestrictionExplicitTimezone : Object, IXsdTypeRestrictionDef {}

public interface GXml.IXsdComplexType : Object, DomElement, IXsdBaseType {
  public const string SCHEMA_NODE_NAME = "complexType";
  /**
  * attribute name = abstract
  */
  public abstract bool abstract { get; set; default = false; }
  /**
  * (#all | List of (extension | restriction))
  */
  public abstract string block { get; set; }
  /**
  * (#all | List of (extension | restriction))
  */
  public abstract string final { get; set; }
  public abstract bool mixed { get; set; }
  public abstract string name { get; set; }
  /**
   * defaultAttributesApply
   */
  public abstract bool default_attributes_apply { get; set; default = true; }
  /**
   * A {@link IXsdComplexType} or {@link IXsdSimpleType}
   */
  public abstract IXsdBaseContent content_type { get; set; }
  /**
   * List of {@link IXsdAttribute} definitions
   */
  public abstract IXsdListAttributes type_attributes { get; }
  /**
   * List of {@link IXsdAttributeGroup} definitions
   */
  public abstract IXsdListAttributesGroup group_attributes { get; }
}

public interface GXml.IXsdExtension : Object, DomElement {
  public const string SCHEMA_NODE_NAME = "extension";
  public abstract string base { get; set; }
}

public interface GXml.IXsdElement : Object, DomElement {
  public const string SCHEMA_NODE_NAME = "element";
  /**
  * attribute name = abstract
  */
  public abstract bool abstract { get; set; }
  /**
   * (#all | List of (extension | restriction | substitution))
  */
  public abstract string block { get; set; }
  public abstract string default { get; set; }
  /**
   * (#all | List of (extension | restriction))
   */
  public abstract string final { get; set; }
  public abstract string fixed { get; set; }
  /**
   * (qualified | unqualified)
   */
  public abstract string form { get; set; }
  public abstract string? id { get; set; }
  /**
   * (nonNegativeInteger | unbounded)  : 1
   */
  public abstract string maxOccurs { get; set; }
  /**
   * nonNegativeInteger : 1
   */
  public abstract string minOccurs { get; set; }
  public abstract string name { get; set; }
  public abstract bool nillable { get; set; default = false; }
  public abstract string ref { get; set; }
  /**
   * substitutionGroup
   */
  public abstract DomTokenList substitution_group { get; set; }
  /**
   * targetNamespace
   */
  public abstract string target_namespace { get; set; }
  /**
   * attribute name = 'type'
   */
  public abstract string object_type { get; set; }
  public abstract IXsdAnnotation anotation { get; set; }
  public abstract IXsdSimpleType simple_type { get; set; }
  public abstract IXsdComplexType complex_type { get; set; }
  // TODO: Missing: ((simpleType | complexType)?, alternative*, (unique | key | keyref)*))
}

public interface GXml.IXsdAnnotation : Object {}

public interface GXml.IXsdBaseContent : Object {
  public abstract IXsdAnnotation anotation { get; set; }
}
public interface GXml.IXsdSimpleContent : Object, IXsdBaseContent {
  public const string SCHEMA_NODE_NAME = "simpleContent";
}
public interface GXml.IXsdComplexContent : Object, IXsdBaseContent {
  public const string SCHEMA_NODE_NAME = "complexContent";
}
public interface GXml.IXsdOpenContent : Object, IXsdBaseContent {}

public interface GXml.IXsdBaseAttribute : Object {
  public abstract IXsdAnnotation anotation { get; set; }
}
public interface GXml.IXsdAttribute : Object {
  public const string SCHEMA_NODE_NAME = "attribute";
}
public interface GXml.IXsdAttributeGroup : Object {
  public const string SCHEMA_NODE_NAME = "attributeGroup";
}

public interface GXml.IXsdList : Object, GomCollection {
  public abstract DomElement element { get; construct set; }
  public abstract Type items_type { get; construct set; }
  public abstract Type items_name { get; construct set; }
  public abstract int length { get; }
  public abstract DomElement? get_item (int index);
  public abstract void append (DomElement element);
  public abstract void remove (int index);
  public abstract int index_of (DomElement element);
}

public interface GXml.IXsdListElements : Object, IXsdList {}
public interface GXml.IXsdListSimpleTypes : Object, IXsdList {}
public interface GXml.IXsdListComplexTypes : Object, IXsdList {}
public interface GXml.IXsdListAttributes : Object, IXsdList {}
public interface GXml.IXsdListAttributesGroup : Object, IXsdList {}
public interface GXml.IXsdListTypeRestrictionEnumerations : Object, IXsdList {}
public interface GXml.IXsdListTypeRestrictionWhiteSpaces : Object, IXsdList {}