Re: dtd question

2010-08-03 Thread Manfred Lotz
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]

Re: dtd question

2010-08-01 Thread Manfred Lotz
Hi Randy, Thanks for your help. A bit late my answer because in the meantime I was on vacation and only now found the time to pursue it further. On Tue, 29 Jun 2010 18:53:30 -0700 (PDT) RandyHudson randy_hud...@mac.com wrote: Yes, you can do this by defining an EntityResolver that corrects the

Re: dtd question

2010-08-01 Thread Randy Hudson
Hi Manfred, I'm sorry the code wasn't quite correct. The EntityResolver is set on the parser's XMLReader, not on the parser itself: (def parser (.newSAXParser (SAXParserFactory/newInstance)) (.setEntityResolver (.getXMLReader parser) resolver) You don't need any external jars: all the classes

Re: dtd question

2010-08-01 Thread Manfred Lotz
Hi Randy, On Sun, 1 Aug 2010 06:23:58 -0700 (PDT) Randy Hudson randy_hud...@mac.com wrote: Hi Manfred, I'm sorry the code wasn't quite correct. The EntityResolver is set on the parser's XMLReader, not on the parser itself: (def parser (.newSAXParser (SAXParserFactory/newInstance))

Re: dtd question

2010-08-01 Thread Michael Wood
On 1 August 2010 17:15, Manfred Lotz manfred.l...@arcor.de wrote: Hi Randy, On Sun, 1 Aug 2010 06:23:58 -0700 (PDT) Randy Hudson randy_hud...@mac.com wrote: Hi Manfred, I'm sorry the code wasn't quite correct. The EntityResolver is set on the parser's XMLReader, not on the parser itself:

Re: dtd question

2010-08-01 Thread Randy Hudson
Right you are Michael; sorry for the missing paren at the end of the def. On Aug 1, 11:59 am, Michael Wood esiot...@gmail.com wrote: On 1 August 2010 17:15, Manfred Lotz manfred.l...@arcor.de wrote: Hi Randy, On Sun, 1 Aug 2010 06:23:58 -0700 (PDT) Randy Hudson randy_hud...@mac.com

Re: dtd question

2010-08-01 Thread Manfred Lotz
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

Re: dtd question

2010-08-01 Thread Randy Hudson
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

dtd question

2010-06-29 Thread Manfred Lotz
Hi there, I got a directory tree of xml documents all having the same dtd. However the dtd file is not where the DOCTYPE SYSTEM entry says it is. Currently, xml/parse throws an exception that the dtd file will not be found. Is there a possibility to tell xml/parse about a different location of

Re: dtd question

2010-06-29 Thread RandyHudson
Yes, you can do this by defining an EntityResolver that corrects the bad system id, define a SAXParser that uses that resolver, and pass the parser into the xml/parse call. Something like this: (import '[javax.xml.parsers SAXParserFactory] '[org.xml.sax EntityResolver InputSource]) (def