--- /dev/null
+(***********************************************************************)
+(* *)
+(* TAToo *)
+(* *)
+(* Kim Nguyen, LRI UMR8623 *)
+(* Université Paris-Sud & CNRS *)
+(* *)
+(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
+(* Recherche Scientifique. All rights reserved. This file is *)
+(* distributed under the terms of the GNU Lesser General Public *)
+(* License, with the special exception on linking described in file *)
+(* ../LICENSE. *)
+(* *)
+(***********************************************************************)
+
+(*
+ Time-stamp: <Last modified on 2013-03-11 00:11:53 CET by Kim Nguyen>
+*)
+
+module NodeKind =
+ struct
+ type t =
+ Document | Element | Text | Comment | Attribute | ProcessingInstruction
+ | Node
+
+ let to_string =
+ function
+ Document -> "document"
+ | Element -> "element"
+ | Attribute -> "attribute"
+ | Text -> "text"
+ | Comment -> "comment"
+ | ProcessingInstruction -> "processing-instruction"
+ | Node -> "node"
+ let print ppf k = Format.fprintf ppf "%s" (to_string k)
+
+
+ let is_a k1 k2 =
+ k1 == Node || k2 == Node || k1 == k2
+end
(***********************************************************************)
(*
- Time-stamp: <Last modified on 2013-03-05 15:12:47 CET by Kim Nguyen>
+ Time-stamp: <Last modified on 2013-03-11 00:12:27 CET by Kim Nguyen>
*)
(** Implementation of documents as binary trees *)
+
module type S =
sig
type node
val print_xml : out_channel -> t -> node -> unit
(** Outputs the tree as an XML document on the given output_channel *)
-
val root : t -> node
(** Returns the root of the tree *)
QName.text, QName.cdata_section or QName.comment
*)
+ val kind : t -> node -> Common.NodeKind.t
+ (** Returns the kind of the given node *)
+
val preorder : t -> node -> int
(** Returns the position of a node in pre-order in the tree. The
root has preorder 0. [nil] has pre-order [-1].