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

Contents of /schema/schema_types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 500 - (show annotations)
Tue Jul 10 17:39:22 2007 UTC (5 years, 10 months ago) by abate
File size: 3859 byte(s)
[r2003-06-12 11:54:45 by cvscast] Merging schema

Original author: cvscast
Date: 2003-06-12 11:54:49+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 (* used to encode content model's "first". None value encode "epsilon" *)
19 module First : Set.S with type elt = string option
20
21 (** {2 XSD representation} *)
22
23 type derivation = Extension | Restriction
24
25 type value_constraint =
26 | Fixed of Value.t
27 | Default of Value.t
28
29 type ws_handling = WS_preserve | WS_replace | WS_collapse
30
31 (* TODO int should be replaced by arbitrary long integers *)
32
33 type facet =
34 | F_length of int * bool (* length, fixed *)
35 | F_minLength of int * bool (* length, fixed *)
36 | F_maxLength of int * bool (* length, fixed *)
37 | F_pattern of Pcre.regexp
38 | F_enumeration of ValueSet.t
39 | F_whiteSpace of ws_handling * bool (* handling, fixed *)
40 | F_maxInclusive of Value.t * bool (* max, fixed *)
41 | F_maxExclusive of Value.t * bool (* max, fixed *)
42 | F_minInclusive of Value.t * bool (* min, fixed *)
43 | F_minExclusive of Value.t * bool (* min, fixed *)
44 | F_totalDigits of int * bool (* digits, fixed *)
45 | F_fractionDigits of int * bool (* digits, fixed *)
46
47 type simple_type_def =
48 | SBuilt_in of string
49 | SUser_defined of
50 string option * (* name *)
51 variety *
52 facet list *
53 simple_type_def ref (* base *)
54
55 and variety =
56 | V_atomic of simple_type_def ref
57 | V_list of simple_type_def ref
58 | V_union of simple_type_def ref list
59
60 type att_decl =
61 string * (* name *)
62 simple_type_def ref * (* type *)
63 value_constraint option
64
65 type attribute_use =
66 bool * (* required *)
67 att_decl *
68 value_constraint option
69
70 type term =
71 | All of particle list
72 | Choice of particle list
73 | Sequence of particle list
74 | Elt of elt_decl ref
75
76 and content_type =
77 | CT_empty
78 | CT_simple of simple_type_def
79 | CT_model of particle * bool (* true -> mixed; false -> element-only *)
80
81 and particle = int * int option * term (* min, max (None = "*"), term *)
82
83 and elt_decl =
84 string * (* name *)
85 type_def ref * (* type *)
86 value_constraint option
87
88 and complex_type_def =
89 | CBuilt_in of string
90 | CUser_defined of
91 string option * (* name *)
92 type_def ref * (* base *)
93 derivation *
94 attribute_use list *
95 content_type
96
97 and type_def =
98 | S of simple_type_def
99 | C of complex_type_def
100
101 type schema = {
102 type_defs : type_def list; (* global _type_ definitions *)
103 att_decls : att_decl list; (* global _attribute_ declarations *)
104 elt_decls : elt_decl list; (* global _element_ declarations *)
105 }
106
107 (** {2 XSD printer *)
108
109 val print_elt_decl : Format.formatter -> elt_decl -> unit
110 val print_type : Format.formatter -> type_def -> unit
111 val print_simple_type : Format.formatter -> simple_type_def -> unit
112 val print_att_decl : Format.formatter -> att_decl -> unit
113 val print_complex_type : Format.formatter -> complex_type_def -> unit
114 val print_ct : Format.formatter -> content_type -> unit
115 val print_particle : Format.formatter -> particle -> unit
116 val print_term : Format.formatter -> term -> unit
117
118 (** {2 Misc} *)
119
120 val name_of_elt_decl : elt_decl -> string
121 val name_of_type_def : type_def -> string
122 val name_of_attribute_use : attribute_use -> string
123
124 class type resolver =
125 object
126 method resolve_att : string -> att_decl ref
127 method resolve_elt : string -> elt_decl ref
128 method resolve_typ : string -> type_def ref
129 end
130
131 (** perform white space normalization according to a white space facet *)
132 val normalize_ws: ws_handling -> string -> string
133

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