/[svn]/schema/schema_types.mli
ViewVC logotype

Contents of /schema/schema_types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 510 - (show annotations)
Tue Jul 10 17:40:25 2007 UTC (5 years, 11 months ago) by abate
File size: 3609 byte(s)
[r2003-06-13 16:12:26 by cvscast] added support for recursive schema types

Original author: cvscast
Date: 2003-06-13 16:12:26+00:00
1
2 (** {2 Validation exceptions} *)
3
4 (** validation failure in an _schema_ document *)
5 exception XSI_validation_error of string
6
7 (** validation failure in an _instance_ document *)
8 exception XSD_validation_error of string
9
10 (** {2 Auxiliary modules} *)
11
12 (* used to encode XML elements' attributes *)
13 module StringMap : Map.S with type key = string
14
15 (* used to encode enumeration facet *)
16 module ValueSet : Set.S with type elt = Value.t
17
18 (** {2 XSD representation} *)
19
20 type derivation = Extension | Restriction
21
22 type value_constraint =
23 | Fixed of Value.t
24 | Default of Value.t
25
26 type ws_handling = WS_preserve | WS_replace | WS_collapse
27
28 (* TODO int should be replaced by arbitrary long integers *)
29
30 type facet =
31 | F_length of int * bool (* length, fixed *)
32 | F_minLength of int * bool (* length, fixed *)
33 | F_maxLength of int * bool (* length, fixed *)
34 | F_pattern of Pcre.regexp
35 | F_enumeration of ValueSet.t
36 | F_whiteSpace of ws_handling * bool (* handling, fixed *)
37 | F_maxInclusive of Value.t * bool (* max, fixed *)
38 | F_maxExclusive of Value.t * bool (* max, fixed *)
39 | F_minInclusive of Value.t * bool (* min, fixed *)
40 | F_minExclusive of Value.t * bool (* min, fixed *)
41 | F_totalDigits of int * bool (* digits, fixed *)
42 | F_fractionDigits of int * bool (* digits, fixed *)
43
44 type simple_type_def =
45 | SBuilt_in of string
46 | SUser_defined of
47 string option * (* name *)
48 variety *
49 facet list *
50 simple_type_def (* base *)
51
52 and variety =
53 | V_atomic of simple_type_def
54 | V_list of simple_type_def
55 | V_union of simple_type_def list
56
57 type att_decl =
58 string * (* name *)
59 simple_type_def * (* type *)
60 value_constraint option
61
62 type attribute_use =
63 bool * (* required *)
64 att_decl *
65 value_constraint option
66
67 type term =
68 | All of particle list
69 | Choice of particle list
70 | Sequence of particle list
71 | Elt of elt_decl ref
72
73 and content_type =
74 | CT_empty
75 | CT_simple of simple_type_def
76 | CT_model of particle * bool (* true -> mixed; false -> element-only *)
77
78 and particle = int * int option * term (* min, max (None = "*"), term *)
79
80 and elt_decl =
81 string * (* name *)
82 type_def ref * (* type *)
83 value_constraint option
84
85 and complex_type_def =
86 | CBuilt_in of string
87 | CUser_defined of
88 int * (* unique id *)
89 string option * (* name *)
90 type_def * (* base *)
91 derivation *
92 attribute_use list *
93 content_type
94
95 and type_def =
96 | S of simple_type_def
97 | C of complex_type_def
98
99 type schema = {
100 type_defs : type_def list; (* global _type_ definitions *)
101 att_decls : att_decl list; (* global _attribute_ declarations *)
102 elt_decls : elt_decl list; (* global _element_ declarations *)
103 }
104
105 (** {2 XSD printer *)
106
107 val print_elt_decl : Format.formatter -> elt_decl -> unit
108 val print_type : Format.formatter -> type_def -> unit
109 val print_simple_type : Format.formatter -> simple_type_def -> unit
110 val print_att_decl : Format.formatter -> att_decl -> unit
111 val print_complex_type : Format.formatter -> complex_type_def -> unit
112 val print_ct : Format.formatter -> content_type -> unit
113 val print_particle : Format.formatter -> particle -> unit
114 val print_term : Format.formatter -> term -> unit
115
116 (** {2 Misc} *)
117
118 val name_of_elt_decl : elt_decl -> string
119 val name_of_type_def : type_def -> string
120 val name_of_att_decl : att_decl -> string
121 val name_of_attribute_use : attribute_use -> string
122
123 (** perform white space normalization according to a white space facet *)
124 val normalize_ws: ws_handling -> string -> string
125

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5