Hi Randy, On Sun, 1 Aug 2010 15:02:59 -0700 (PDT) Randy Hudson <randy_hud...@mac.com> wrote:
> I think we're almost there, sorry for the various mistakes. > > If you look in the source for clojure.xml, you can see that the > default "startparse" argument for xml/parse is > > (defn startparse-sax [s ch] > (.. SAXParserFactory (newInstance) (newSAXParser) (parse s ch))) > > and we've only gotten as far as the newSAXParser part with the > definition of parser. So: > > (defn startparse [s ch] (.parse parser s ch)) > (defn parse-xml [source] (xml/parse source startparse)) > Indeed now it compiles. I also played with startparse but my mistake was to omit the dot in front of parse. For some reasons I do not get it to ignore the DTD but it seems (from Google search) that others had that issue before with EntityResolver. It looks like resolver gets ignored. But I found this Java snippet: SAXParser parser = factory.newSAXParser(); parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); This is the code that works now: (ns xmltest (:require [clojure.zip :as zip] [clojure.xml :as xml]) (:use clojure.contrib.zip-filter.xml)) (import '[javax.xml.parsers SAXParserFactory]) (def parser (let [pf (SAXParserFactory/newInstance)] (do (. pf setFeature "http://apache.org/xml/features/nonvalidating/load-external-dtd" false) (.newSAXParser pf)))) (defn startparse [s ch] (.parse parser s ch)) (defn parse-xml [source] (xml/parse source startparse)) (parse-xml (java.io.File. "test.xml")) Thanks a lot for your help. -- Manfred -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en