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 resolver
(proxy [EntityResolver] []
(resolveEntity [public-id system-id]
(InputSource.
(if (= system-id the-bad-system-id)
the-good-system-id
system-id)))))
(def parser
(doto (.newSAXParser (SAXParserFactory/newInstance))
(.setEntityResolver resolver)))
(defn parse-xml [source] (xml/parse source parser))
On Jun 29, 8:18 pm, Manfred Lotz <[email protected]> wrote:
> 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 that dtd file?
>
> --
> Thanks,
> Manfred
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en