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))

should finally do it.

I do apologize, I'd forgotten about the function wrapper part of this
machinery. I hope this has been helpful despite my mistakes.


On Aug 1, 2:50 pm, Manfred Lotz <manfred.l...@arcor.de> wrote:
> Hi Randy,
>
> On Sun, 1 Aug 2010 10:04:16 -0700 (PDT)
>
> Randy Hudson <randy_hud...@mac.com> wrote:
> > Right you are Michael; sorry for the missing paren at the end of the
> > def.
>
> Now compiling the code works:
>
> (def parser (.newSAXParser (SAXParserFactory/newInstance)))
>
> (.setEntityResolver (.getXMLReader parser) resolver)
>
> (defn parse-xml [source] (xml/parse source parser))
>
> however when trying to apply it by adding
>
> (parse-xml (java.io.File. "test.xml"))    
>
> it no longer compiles:
> Exception in thread "main" java.lang.ClassCastException:
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl cannot be cast to
> clojure.lang.IFn (xmltest1.clj:0)
>
> --
> Thanks,
> 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

Reply via email to