[Ocaml-pxp-users] Help needed with PXP api

Alain Frisch Alain.Frisch at inria.fr
Tue Mar 8 06:31:47 PST 2005


Hello,

Gerd, thanks a lot for the detailled answer. In order to avoid dealing 
with Neturl (because the application has its own Url library), I cooked 
this simple resolver:

let channel_of_id rid =
   let url =
     match rid.rid_system_base, rid.rid_system with
       | Some base, Some rel when not (Url.is_url rel) ->
             Url.local base rel
       | _, Some rel -> rel
       | _ -> raise Not_competent
   in
   let ch =
     if Url.is_url url
     then new Netchannels.input_string (Url.load_url url)
     else new Netchannels.input_channel (open_in_bin url)
   in
   ch, None, Some { rid with rid_system = Some url }

let resolver = new resolve_to_any_obj_channel ~channel_of_id ()


and I simply use the source XExtID (System uri,None,resolver).


Url.load_url is my magic function. Url.is_url checks whether a string 
starts with a URL schema. Url.local apply a relative URL to a base URL 
(it also works with file names).

Do you see anything wrong with this resolver ?



-- Alain



More information about the Ocaml-pxp-users mailing list