(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                            XML Query Engine                         *)
(*                                                                     *)
(*  Copyright 2001-2003, Lucent Technologies.                          *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: sax_typesutil.mli,v 1.4 2003/06/16 15:34:34 simeon Exp $ *)

(* Module: Sax_typesutil
   Description:
     This module implements a few operations on SAX events.
*)

(* SAX events accessors *)

val get_start_document          : Sax_types.xml_stream -> Sax_types.sax_xml_decl option
val get_end_document            : Sax_types.xml_stream -> unit


(* Extracts special attributes *)

val extract_special_attributes :
    Sax_types.sax_xml_attribute_forest -> 
      (Whitespace.mode * (Namespace.prefix * Namespace.uri) list * Sax_types.sax_xml_attribute_forest)


(* Generic SAX handler *)

type 'a sax_handler =
    { handle_start_document : 'a -> Sax_types.sax_xml_decl option * Sax_types.sax_dtd_decl -> 'a;
      handle_end_document : 'a -> unit -> 'a;
      handle_start_element : 'a -> Sax_types.element_desc -> 'a;
      handle_end_element : 'a -> Namespace.uqname -> 'a;
      handle_processing_instruction : 'a -> Sax_types.pi_desc -> 'a;
      handle_comment : 'a -> Sax_types.comment_desc -> 'a;
      handle_characters : 'a -> Sax_types.text_desc -> 'a;
      handle_attribute : 'a -> Sax_types.sax_xml_attribute -> 'a;
      handle_atomic_value : 'a -> Datatypes._AtomicValue -> 'a }

val xml_generic_parse : 'a sax_handler -> Sax_types.sax_event Stream.t -> 'a -> 'a

