ns.mli 2.11 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 dump_table: Format.formatter -> table -> unit
50

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

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

58 59 60
val map_tag: table -> Utf8.t -> QName.t
val map_attr: table -> Utf8.t -> QName.t
val map_prefix: table -> Utf8.t -> Uri.t
61 62 63 64 65 66 67

(* Support for printing XML documents *)

module Printer : sig
  type printer

  val printer: table -> printer
68 69
  val register_ns: printer -> Uri.t -> unit
  val register_qname: printer -> QName.t -> unit
70

71 72 73
  val prefixes: printer -> (Utf8.t * Uri.t) list
  val tag: printer -> QName.t -> string
  val attr: printer -> QName.t -> string
74 75 76 77
end
    

(***)
78 79 80 81

module InternalPrinter : sig
  val set_table: table -> unit

82 83 84 85 86 87
  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
88 89 90 91

  val dump: Format.formatter -> unit
end

92