module XmlRPCTypes: sig end
Interfacing XML-RPC and ocaml types
|
XML-RPC structs
|
type
xrs
t
. You don't need to know how the
structs are implemented internally (But if you're curious, as
(string, t) Hashtbl.t
at the moment), just use the functions
described below to get at and access pairs.
XML-RPC types
|
typet =
[ `Array of t array
| `Base64 of string
| `Boolean of bool
| `DateTime of string
| `Double of float
| `Int of int32
| `RawBase64 of string
| `String of string
| `Struct of xrs
| `Unit ]
Note that for `Base64
, the string argument should not be
actually base64-encoded by you. Use '`RawBase64
to hold data that's
already thus encoded.
type
fault = {
|
desc : |
|
code : |
Structs again
|
val make_struct : unit -> xrs
val add_elem : xrs -> string -> t -> unit
val find_elem : xrs -> string -> t
Not_found
if the element isn't
present
Miscellanous routines
|
exception Bad_type
val escape_cdata : string -> string
escape_cdata string
turns <, > and & into XML/HTML entities
Converting types
|
Ocaml to XML-RPC
|
val xr_of_int : int -> t
val xr_of_int32 : int32 -> t
val xr_of_string : string -> t
val xr_of_bool : bool -> t
val xr_of_float : float -> t
val xr_of_base64 : string -> t
xr_of_base64
will store data that's not already base-64 encoded.val xr_of_rawbase64 : string -> t
xr_of_rawbase64
does expect its argument to already be encoded.val xr_of_array : t array -> t
val xr_of_struct : xrs -> t
val skip : t
XML-RPC to Ocaml
|
val ml_of_int : t -> int
XmlRPCTypes.t
of the wrong type for what you want
to convert it to, they will raise XmlRPCTypes.Bad_type
in revenge.val ml_of_int32 : t -> int32
val ml_of_string : t -> string
val ml_of_float : t -> float
val ml_of_bool : t -> bool
val ml_of_base64 : t -> string
ml_of_base64
will return the decoded dataval ml_of_rawbase64 : t -> string
ml_of_rawbase64
will return the data still base64-encodedval ml_of_struct : t -> xrs
val ml_of_datetime : t -> string
val ml_of_fault : t -> fault
val ml_of_array : t -> t array
val ml_of_intarray : t -> int array
val ml_of_int32array : t -> int32 array
val ml_of_floatarray : t -> float array
val ml_of_datetimearray : t -> string array
val ml_of_base64array : t -> string array
val ml_of_rawbase64array : t -> string array
val ml_of_stringarray : t -> string array
val ml_of_boolarray : t -> bool array
val ml_of_structarray : t -> xrs array
XML conversion
|
val print_type : t -> string
print_type t
returns its argument as an XML-RPC value stringval parse_value : ('a Pxp_document.node #Pxp_document.extension as 'a) Pxp_document.node ->
t
parse_value node
takes a PXP value node and returns its XML-RPC value. The node must be a <value>.