ns.mli 1.5 KB
Newer Older
1 2 3 4
open Encodings

exception UnknownPrefix of Utf8.t

5
include Custom.T with type t = int  (* Namespaces (URIs) *)
6 7 8 9 10
val mk: Utf8.t -> t
val value: t -> Utf8.t
val empty : t

type qname = t * Utf8.t
11 12 13 14 15 16
module QName : sig
  include Custom.T with type t = qname
  val to_string: t -> string
  val print: Format.formatter -> t -> unit
end

17

18
type table  (* prefix => namespace *)
19 20
val serialize_table: table Serialize.Put.f
val deserialize_table: table Serialize.Get.f
21
val empty_table: table  (* Contains only xml *)
22
val add_prefix: Utf8.t -> t -> table -> table
23
val dump_table: Format.formatter -> table -> unit
24 25 26 27 28

val process_start_tag:
  table -> string -> (string * string) list -> 
    table * qname * (qname * Utf8.t) list

29
(*
30
val print_qname: Format.formatter -> qname -> unit 
31
*)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

val map_tag: table -> Utf8.t -> qname
val map_attr: table -> Utf8.t -> qname
val map_prefix: table -> Utf8.t -> t

(* Support for printing XML documents *)

module Printer : sig
  type printer

  val printer: table -> printer
  val register_tag: printer -> qname -> unit
  val register_attr: printer -> qname -> unit

  val prefixes: printer -> (Utf8.t * t) list
  val tag: printer -> qname -> string
  val attr: printer -> qname -> string
end
    

(***)
53 54 55 56

module InternalPrinter : sig
  val set_table: table -> unit

57
  val any_ns: t -> string
58 59 60 61 62 63 64
  val tag: qname -> string
  val attr: qname -> string

  val dump: Format.formatter -> unit
end

(*
65 66 67 68
val register_prefix : Utf8.t -> t -> unit
val prefix : t -> Utf8.t

val dump_prefix_table : Format.formatter -> unit
69
*)