     [:comment text]
   "
   [f & [opts]]
-  (let [{:keys [namespaces]} opts]
+  (let [{:keys [namespaces line-numbers]} opts
+        locator (atom nil)
+        with-line-numbers (fn [evt]
+                            (if-let [^Locator loc @locator]
+                              (with-meta
+                                evt
+                                {:line (.getLineNumber loc)
+                                 :col  (.getColumnNumber loc)})
+                              evt))
+        f (if line-numbers
+            #(f (with-line-numbers %))
+            f)]
+    
     (proxy [DefaultHandler2] []
-    
+
+      ;; For getting line & column numbers
+      (setDocumentLocator [^Locator loc]
+        (reset! locator loc))
+      
       ;; Elements
       (startElement [uri local-name q-name attrs]
         (f [:start-element uri local-name q-name (attrs->map attrs namespaces)]))

                          content
                          uri)
                (if prefix
                  (assoc ns-map :prefix prefix) ;TODO - intern this somehow
                  ns-map))))
          (fn [[_ _ _ q-name attrs] content _]
            (Element. (keyword q-name)
                      attrs

      xml-escape
      (.replaceAll "'"  "&apos;")))

(extend-protocol XMLWritableAttr
  clojure.lang.Keyword
  (emit-attr [kwd val ^Writer out]
    (doto out
      (.write (name kwd))
      (.write "=\"")
      (.write (xml-escape-attr (str val)))
      (.write \")))

  clojure.lang.IPersistentVector
  (emit-attr [[name uri] ]))

(defn emit-element [^Element e ^Writer out]
  (let [tag (tag e)
