ns.mli 2.3 KB
Newer Older
1 2
open Encodings

3

4 5 6 7 8
module Uri : Upool.S with type value = Utf8.t
  (* Namespaces URIs *)

module QName : sig
  include Custom.T with type t = Uri.t * Utf8.t
9

10 11 12 13 14 15 16
  val to_string: t -> string
  val print: Format.formatter -> t -> unit
(*
  val mk_ascii: string -> t
  val get_ascii: t -> string
*)
end
17

18 19 20 21 22 23
module Label : sig
  (* Qualified names of the form (nsuri:localname). Used
     as labels in records *)
  include Upool.S with type value = QName.t
  val print_tag: Format.formatter -> t -> unit
  val print_attr: Format.formatter -> t -> unit
24

25 26 27
  val print_quote: Format.formatter -> t -> unit
  val mk_ascii: string -> t
  val get_ascii: t -> string
28

29 30
  val string_of_attr: t -> string
  val string_of_tag: t -> string
31

32
(*
33 34
  val to_string: t -> string
  val print: Format.formatter -> t -> unit
35 36 37
  val of_qname: Uri.t -> Utf8.t -> t
  val split: t -> Utf8.t * Utf8.t
*)
38 39
end

40 41 42 43
exception UnknownPrefix of Utf8.t

val empty : Uri.t
val xml_ns: Uri.t
44

45 46
type table  (* prefix => namespace *)
val empty_table: table  (* Contains only xml *)
47
val def_table: table (* Contains xml,xsd,xsi *)
48
val add_prefix: Utf8.t -> Uri.t -> table -> table
49
val merge_tables: table -> table -> table
50
val dump_table: Format.formatter -> table -> unit
51

52 53
val get_table: table -> (Utf8.t * Uri.t) list
val mk_table: (Utf8.t * Uri.t) list -> table
54

55 56
val process_start_tag:
  table -> string -> (string * string) list -> 
57
    table * QName.t * (Label.t * Utf8.t) list
58

59 60 61 62
val process_start_tag_subst:
  table -> string -> (string * string) list ->
  Uri.t Hashtbl.Make(Uri).t -> table * QName.t * (Label.t * Utf8.t) list 

63 64 65
val map_tag: table -> Utf8.t -> QName.t
val map_attr: table -> Utf8.t -> QName.t
val map_prefix: table -> Utf8.t -> Uri.t
66 67 68 69 70 71 72

(* Support for printing XML documents *)

module Printer : sig
  type printer

  val printer: table -> printer
73 74
  val register_ns: printer -> Uri.t -> unit
  val register_qname: printer -> QName.t -> unit
75

76 77 78
  val prefixes: printer -> (Utf8.t * Uri.t) list
  val tag: printer -> QName.t -> string
  val attr: printer -> QName.t -> string
79 80 81 82
end
    

(***)
83 84 85 86

module InternalPrinter : sig
  val set_table: table -> unit

87 88 89 90 91 92
  val any_ns: Uri.t -> string
  val tag: QName.t -> string
  val attr: QName.t -> string

  val print_tag: Format.formatter -> QName.t -> unit
  val print_any_ns: Format.formatter -> Uri.t -> unit
93 94 95 96

  val dump: Format.formatter -> unit
end

97