                              XMLStreamConstants)
            (java.nio.charset Charset)
            (java.io Reader)))
-(set! *warn-on-reflection* true)
+
 ; Represents a parse event.
 ; type is one of :start-element, :end-element, or :characters
 (defrecord Event [type name attrs str])


(defn write-attributes [{:keys (attrs)} ^javax.xml.stream.XMLStreamWriter writer]
  (doseq [[k v] attrs]
    (.writeAttribute writer (str (namespace k)) (name k) (str v))))

; Represents a node of an XML tree
(defrecord Element [tag attrs content]

  (let [fac (doto (javax.xml.stream.XMLInputFactory/newInstance)
              (.setProperty javax.xml.stream.XMLInputFactory/IS_COALESCING true))
        sreader (.createXMLStreamReader fac s)]
    (doall (pull-seq sreader))))

(defn parse
  "Convenience function. Parses the source, which can be a File,
