sig
  type encoding =
      [ `ISO_8859_1 | `US_ASCII | `UTF_16 | `UTF_16BE | `UTF_16LE | `UTF_8 ]
  type dtd = string option
  type name = string * string
  type attribute = Xmlm.name * string
  type tag = Xmlm.name * Xmlm.attribute list
  type signal =
      [ `Data of string | `Dtd of Xmlm.dtd | `El_end | `El_start of Xmlm.tag ]
  val ns_xml : string
  val ns_xmlns : string
  type pos = int * int
  type error =
      [ `Expected_char_seqs of string list * string
      | `Expected_root_element
      | `Illegal_char_ref of string
      | `Illegal_char_seq of string
      | `Malformed_char_stream
      | `Max_buffer_size
      | `Unexpected_eoi
      | `Unknown_encoding of string
      | `Unknown_entity_ref of string
      | `Unknown_ns_prefix of string ]
  val error_message : Xmlm.error -> string
  exception Error of Xmlm.pos * Xmlm.error
  type source =
      [ `Channel of Pervasives.in_channel
      | `Fun of unit -> int
      | `String of int * string ]
  type input
  val make_input :
    ?enc:Xmlm.encoding option ->
    ?strip:bool ->
    ?ns:(string -> string option) ->
    ?entity:(string -> string option) -> Xmlm.source -> Xmlm.input
  val input : Xmlm.input -> Xmlm.signal
  val input_tree :
    el:(Xmlm.tag -> 'a list -> 'a) -> data:(string -> 'a) -> Xmlm.input -> 'a
  val input_doc_tree :
    el:(Xmlm.tag -> 'a list -> 'a) ->
    data:(string -> 'a) -> Xmlm.input -> Xmlm.dtd * 'a
  val peek : Xmlm.input -> Xmlm.signal
  val eoi : Xmlm.input -> bool
  val pos : Xmlm.input -> Xmlm.pos
  type 'a frag = [ `Data of string | `El of Xmlm.tag * 'a list ]
  type dest =
      [ `Buffer of Buffer.t
      | `Channel of Pervasives.out_channel
      | `Fun of int -> unit ]
  type output
  val make_output :
    ?decl:bool ->
    ?nl:bool ->
    ?indent:int option ->
    ?ns_prefix:(string -> string option) -> Xmlm.dest -> Xmlm.output
  val output : Xmlm.output -> Xmlm.signal -> unit
  val output_depth : Xmlm.output -> int
  val output_tree : ('-> 'Xmlm.frag) -> Xmlm.output -> '-> unit
  val output_doc_tree :
    ('-> 'Xmlm.frag) -> Xmlm.output -> Xmlm.dtd * '-> unit
  type std_string = string
  type std_buffer = Buffer.t
  module type String =
    sig
      type t
      val empty : Xmlm.String.t
      val length : Xmlm.String.t -> int
      val append : Xmlm.String.t -> Xmlm.String.t -> Xmlm.String.t
      val lowercase : Xmlm.String.t -> Xmlm.String.t
      val iter : (int -> unit) -> Xmlm.String.t -> unit
      val of_string : Xmlm.std_string -> Xmlm.String.t
      val to_utf_8 :
        ('-> Xmlm.std_string -> 'a) -> '-> Xmlm.String.t -> 'a
      val compare : Xmlm.String.t -> Xmlm.String.t -> int
    end
  module type Buffer =
    sig
      type string
      type t
      exception Full
      val create : int -> Xmlm.Buffer.t
      val add_uchar : Xmlm.Buffer.t -> int -> unit
      val clear : Xmlm.Buffer.t -> unit
      val contents : Xmlm.Buffer.t -> Xmlm.Buffer.string
      val length : Xmlm.Buffer.t -> int
    end
  module type S =
    sig
      type string
      type encoding =
          [ `ISO_8859_1
          | `US_ASCII
          | `UTF_16
          | `UTF_16BE
          | `UTF_16LE
          | `UTF_8 ]
      type dtd = Xmlm.S.string option
      type name = Xmlm.S.string * Xmlm.S.string
      type attribute = Xmlm.S.name * Xmlm.S.string
      type tag = Xmlm.S.name * Xmlm.S.attribute list
      type signal =
          [ `Data of Xmlm.S.string
          | `Dtd of Xmlm.S.dtd
          | `El_end
          | `El_start of Xmlm.S.tag ]
      val ns_xml : Xmlm.S.string
      val ns_xmlns : Xmlm.S.string
      type pos = int * int
      type error =
          [ `Expected_char_seqs of Xmlm.S.string list * Xmlm.S.string
          | `Expected_root_element
          | `Illegal_char_ref of Xmlm.S.string
          | `Illegal_char_seq of Xmlm.S.string
          | `Malformed_char_stream
          | `Max_buffer_size
          | `Unexpected_eoi
          | `Unknown_encoding of Xmlm.S.string
          | `Unknown_entity_ref of Xmlm.S.string
          | `Unknown_ns_prefix of Xmlm.S.string ]
      exception Error of Xmlm.S.pos * Xmlm.S.error
      val error_message : Xmlm.S.error -> Xmlm.S.string
      type source =
          [ `Channel of Pervasives.in_channel
          | `Fun of unit -> int
          | `String of int * Xmlm.std_string ]
      type input
      val make_input :
        ?enc:Xmlm.S.encoding option ->
        ?strip:bool ->
        ?ns:(Xmlm.S.string -> Xmlm.S.string option) ->
        ?entity:(Xmlm.S.string -> Xmlm.S.string option) ->
        Xmlm.S.source -> Xmlm.S.input
      val input : Xmlm.S.input -> Xmlm.S.signal
      val input_tree :
        el:(Xmlm.S.tag -> 'a list -> 'a) ->
        data:(Xmlm.S.string -> 'a) -> Xmlm.S.input -> 'a
      val input_doc_tree :
        el:(Xmlm.S.tag -> 'a list -> 'a) ->
        data:(Xmlm.S.string -> 'a) -> Xmlm.S.input -> Xmlm.S.dtd * 'a
      val peek : Xmlm.S.input -> Xmlm.S.signal
      val eoi : Xmlm.S.input -> bool
      val pos : Xmlm.S.input -> Xmlm.S.pos
      type 'a frag = [ `Data of Xmlm.S.string | `El of Xmlm.S.tag * 'a list ]
      type dest =
          [ `Buffer of Xmlm.std_buffer
          | `Channel of Pervasives.out_channel
          | `Fun of int -> unit ]
      type output
      val make_output :
        ?decl:bool ->
        ?nl:bool ->
        ?indent:int option ->
        ?ns_prefix:(Xmlm.S.string -> Xmlm.S.string option) ->
        Xmlm.S.dest -> Xmlm.S.output
      val output_depth : Xmlm.S.output -> int
      val output : Xmlm.S.output -> Xmlm.S.signal -> unit
      val output_tree : ('-> 'Xmlm.S.frag) -> Xmlm.S.output -> '-> unit
      val output_doc_tree :
        ('-> 'Xmlm.S.frag) -> Xmlm.S.output -> Xmlm.S.dtd * '-> unit
    end
  module Make :
    functor (String : String->
      functor
        (Buffer : sig
                    type string = String.t
                    type t
                    exception Full
                    val create : int -> t
                    val add_uchar : t -> int -> unit
                    val clear : t -> unit
                    val contents : t -> string
                    val length : t -> int
                  end->
        sig
          type string = String.t
          type encoding =
              [ `ISO_8859_1
              | `US_ASCII
              | `UTF_16
              | `UTF_16BE
              | `UTF_16LE
              | `UTF_8 ]
          type dtd = string option
          type name = string * string
          type attribute = name * string
          type tag = name * attribute list
          type signal =
              [ `Data of string | `Dtd of dtd | `El_end | `El_start of tag ]
          val ns_xml : string
          val ns_xmlns : string
          type pos = int * int
          type error =
              [ `Expected_char_seqs of string list * string
              | `Expected_root_element
              | `Illegal_char_ref of string
              | `Illegal_char_seq of string
              | `Malformed_char_stream
              | `Max_buffer_size
              | `Unexpected_eoi
              | `Unknown_encoding of string
              | `Unknown_entity_ref of string
              | `Unknown_ns_prefix of string ]
          exception Error of pos * error
          val error_message : error -> string
          type source =
              [ `Channel of in_channel
              | `Fun of unit -> int
              | `String of int * std_string ]
          type input
          val make_input :
            ?enc:encoding option ->
            ?strip:bool ->
            ?ns:(string -> string option) ->
            ?entity:(string -> string option) -> source -> input
          val input : input -> signal
          val input_tree :
            el:(tag -> 'a list -> 'a) -> data:(string -> 'a) -> input -> 'a
          val input_doc_tree :
            el:(tag -> 'a list -> 'a) ->
            data:(string -> 'a) -> input -> dtd * 'a
          val peek : input -> signal
          val eoi : input -> bool
          val pos : input -> pos
          type 'a frag = [ `Data of string | `El of tag * 'a list ]
          type dest =
              [ `Buffer of std_buffer
              | `Channel of out_channel
              | `Fun of int -> unit ]
          type output
          val make_output :
            ?decl:bool ->
            ?nl:bool ->
            ?indent:int option ->
            ?ns_prefix:(string -> string option) -> dest -> output
          val output_depth : output -> int
          val output : output -> signal -> unit
          val output_tree : ('-> 'a frag) -> output -> '-> unit
          val output_doc_tree : ('-> 'a frag) -> output -> dtd * '-> unit
        end
end