 (add-context-input-format :galicia
                           (fn [rdr]
                             (try
-                             (let [xml-tree (parse-seq rdr)]
-                               (and (= :Galicia_Document (-> xml-tree first :name))
-                                    (= :BinaryContext (-> xml-tree second :name))))
+                             (let [xml-tree (xml/parse rdr)]
+                               (and (= :Galicia_Document (-> xml-tree :tag))
+                                    (= :BinaryContext (-> xml-tree :content first :tag))))
                              (catch Exception _))))
 
 (define-context-output-format :galicia

(define-context-input-format :galicia
  [file]
  (with-in-reader file
    (let [ctx-xml-tree (-> (parse-trim *in*) :content first)

          nr-objs (Integer/parseInt (-> ctx-xml-tree :attrs :numberObj))
          nr-atts (Integer/parseInt (-> ctx-xml-tree :attrs :numberAtt))

        conexp.fca.contexts
        conexp.io.util
        conexp.io.latex)
  (:use [clojure.string :only (split)])
  (:require [clojure.data.xml :as xml])
  (:import [java.io PushbackReader]))


