Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 108 lines (88 sloc) 3.827 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (** Wsdl2mlCommon:
19 Common code between wsdl2ml translator and generated code runtime.
20 *)
21
22 (** Simple tree type, straight out of the example docs for Xmlm.
23 *)
24 type tree = E of Xmlm.tag * tree list | D of string
25
26 (** Some basic conversion functions *)
27 val sname : Xmlm.name -> string
28 val satt : Xmlm.attribute -> string
29 val satts : Xmlm.attribute list -> string
30 val stag : Xmlm.tag -> string
31 val gtag : tree -> Xmlm.tag
32 val gts : tree -> tree list
33 val mkname : string -> string -> Xmlm.name
34 val mkatt : Xmlm.name -> string -> Xmlm.attribute
35 val mktag : Xmlm.name -> Xmlm.attribute list -> Xmlm.tag
36 val mkstag : string -> Xmlm.tag
37
38 (** Xml input/output *)
39 val in_tree : Xmlm.input -> Xmlm.dtd * tree
40 val out_tree : Xmlm.output -> Xmlm.dtd * tree -> unit
41 val string_of_tree : ?hint:int -> Xmlm.dtd * tree -> string
42 val sxml : tree list -> string
43
44 (** Searching the Xmlm data structure *)
45 val is_name : Xmlm.name -> Xmlm.name -> bool
46 val is_uqname : Xmlm.name -> Xmlm.name -> bool
47 val find_tag : (Xmlm.tag -> bool) -> tree list -> tree option
48 val find_att : Xmlm.name -> Xmlm.attribute list -> string option
49
50 (** Read in XML tree from string, file etc. *)
51 val get_tree_string : string -> Xmlm.dtd * tree
52 val get_tree_filename : string -> Xmlm.dtd * tree
53
54 (** Tree transformers *)
55 val null_fold_tree_f : 'a -> tree -> 'a
56 val fold_tree : ('a -> tree -> 'a) -> 'a -> tree -> 'a
57 val fold_trees : ('a -> tree -> 'a) -> 'a -> ('b * ('c * tree)) list -> 'a
58 val find_trees : ('a -> bool) -> ('b * ('c * 'a)) list -> 'a list
59
60 (** Support for XMLScema datatypes *)
61
62 (** dateTime *)
63 type t_dateTime = Time.t
64 val string_of_dateTime : t_dateTime -> string
65 val dateTime_of_string : string -> t_dateTime
66
67 (** byte: just an int with range checks -127 <= b <= 128 *)
68 type t_byte = int
69 val chk_byte : string -> int -> unit
70 val string_of_byte : t_byte -> string
71 val byte_of_string : string -> t_byte
72
73 (** Error exceptions generated by the code *)
74 exception Wsdl2mlOccurs of int * int * tree list
75 exception Wsdl2mlNonMtchCon of string
76 exception Wsdl2mlInputFailure of string
77
78 (** fx does nothing except translate error exceptions
79 into Wsdl2mlInputFailure. Needed by fromxml functions
80 and is used by generated code.
81 *)
82 val fx : string -> ('a -> 'b) -> 'a -> 'b
83
84 (** Generic transformers for types found in <any/> elements. *)
85 val toxml_string : string -> tree list
86 val toxml_int : int -> tree list
87 val toxml_byte : t_byte -> tree list
88 val toxml_float : float -> tree list
89 val toxml_bool : bool -> tree list
90 val toxml_dateTime : t_dateTime -> tree list
91 val fromxml_string : tree list -> string
92 val fromxml_int : tree list -> int
93 val fromxml_byte : tree list -> t_byte
94 val fromxml_float : tree list -> float
95 val fromxml_bool : tree list -> bool
96 val fromxml_dateTime : tree list -> t_dateTime
97
98 (** Support for generated input parser. *)
99 val find_name : string -> tree list -> tree list
100 val find_names : string list -> tree list -> tree list
101
102 (** Some support for digging around in the XML tree. *)
103 val get_sts : string -> tree list -> tree list
104 val sts_names : tree list -> string list
105 val dig_sts : string list -> tree list -> string list * tree list
106 val is_tree_name : string -> tree -> bool
107
Something went wrong with that request. Please try again.