daabd097b7d2265dea2aea97152721fd09039aee
[tatoo.git] / src / test.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (*  Recherche Scientifique. All rights reserved.  This file is         *)
10 (*  distributed under the terms of the GNU Lesser General Public       *)
11 (*  License, with the special exception on linking described in file   *)
12 (*  ../LICENSE.                                                        *)
13 (*                                                                     *)
14 (***********************************************************************)
15
16
17 (** use: xml_file "XPath querie"
18     or : xml_file -f XPath_querie_file
19     only the first line of XPath_querie_file is read 
20 *)
21
22 module F = Formula
23 module A = Ata
24 (* to force ocaml build to add Formula to the dependency chain even if
25    we don't use it yet*)
26
27 let doc =
28   let fd = open_in Sys.argv.(1) in
29   let d = Tree.load_xml_file fd in
30   close_in fd; d
31
32
33 let query = 
34   let arg2 = Sys.argv.(2) in
35   Uparser.xpath Ulexer.token (Ulexing.from_latin1_string arg2)
36
37 open Format
38
39 let () =
40   fprintf err_formatter "Query: %a\n%!" XPath.Ast.print_path query;
41   fprintf err_formatter "Document:\n%!";
42   Tree.print_xml stderr doc (Tree.root doc);
43   exit 0
44