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

(* $Id: xml_ast.mli,v 1.7 2002/10/27 20:02:52 simeon Exp $ *)

(*************************************************)
(* Simple Abstract Syntax Tree for XML documents *)
(*************************************************)

open Sym

(* This module contains data structures used to represent the abstract
   syntax tree corresponding to a parsed XML document *)

(* Note:
     The AST here has be designed to be minimalistic. The objective is
     to reduce the memory required to represent a given XML document.
   - Jerome
 *)

(***********)
(* XML AST *)
(***********)

type xml_attribute =
    attr_symbol * Datatypes._untyped

and xml_attribute_forest =
    xml_attribute list

type xml_node =
  | XElem of
      elem_symbol * xml_attribute_forest * xml_node_forest (* Element  : <a b1="">...</a> *)
  | XText of Datatypes._untyped                                  (* Text content        : <a> This is text </a> *)
  | XPI of (Namespace.ncname * Datatypes._untyped)                 (* Processing instruction: <? ... ?> *)
  | XComment of Datatypes._untyped                               (* Comment: <!-- ... --> *)

and xml_node_forest = xml_node list

type xml_prolog =
    { xml_decl: (Datatypes._untyped * Conf.encoding_kind option * Datatypes._untyped option) option;
      xml_misc_prolog: xml_node_forest }

type xml_document =
    { xml_prolog: xml_prolog;
      xml_root: xml_node;
      xml_misc: xml_node_forest }

(******************)
(* XML Schema AST *)
(******************)

type xml_schema_document = xml_document

