ns.mli 1.82 KB
Newer Older
1 2
open Encodings

3 4
val split_qname: Utf8.t -> string * Utf8.t

5 6
exception UnknownPrefix of Utf8.t

7
include Upool.S with type value = Utf8.t (* Namespaces (URIs) *)
8
val mk: Utf8.t -> t
9
val mk_ascii: string -> t
10
val value: t -> Utf8.t
11 12


13 14
val empty : t

15 16
val xml_ns: t

17
type qname = t * Utf8.t
18 19 20 21 22 23
module QName : sig
  include Custom.T with type t = qname
  val to_string: t -> string
  val print: Format.formatter -> t -> unit
end

24

25
type table  (* prefix => namespace *)
26 27
val serialize_table: table Serialize.Put.f
val deserialize_table: table Serialize.Get.f
28
val empty_table: table  (* Contains only xml *)
29
val def_table: table (* Contains xml,xsd,xsi *)
30
val add_prefix: Utf8.t -> t -> table -> table
31
val dump_table: Format.formatter -> table -> unit
32

33
val get_table: table -> (Utf8.t * Utf8.t) list
34
val mk_table: (Utf8.t * Utf8.t) list -> table
35

36 37 38
val get_table_ns: table -> (Utf8.t * t) list
val mk_table_ns: (Utf8.t * t) list -> table

39 40 41 42
val process_start_tag:
  table -> string -> (string * string) list -> 
    table * qname * (qname * Utf8.t) list

43
(*
44
val print_qname: Format.formatter -> qname -> unit 
45
*)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

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
    

(***)
67 68 69 70

module InternalPrinter : sig
  val set_table: table -> unit

71
  val any_ns: t -> string
72 73 74 75 76 77 78
  val tag: qname -> string
  val attr: qname -> string

  val dump: Format.formatter -> unit
end

(*
79 80 81 82
val register_prefix : Utf8.t -> t -> unit
val prefix : t -> Utf8.t

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