Hi Rom

From: "ramen chatterjee" <[EMAIL PROTECTED]>
> I apologise if this is a stupid question, but Ive looked many places and
not
> quite found the answer.
>
> I want to read a file ascertain its doctype and then validate it against
my
> chosen dtd based on doctype.
>
> My problem is twofold. First I need to parse the document to get the
doctype
> but will the parser make this available?
>
> Secondly having parsed it once, re-parse telling the parser to use my
chosen
> dtd ignoring any specified in the file, is this possible?
>
> Hope someone out there can help (or at least point me in the direction of
a
> good place to look)
>
> Thanks
>
> Rom

The trick for this is to implement your own SAX EntityResolver. You'll then
be notified as a DOCTYPE is found and can then load the DTD from any
location you wish (from the classpath or some local file or whatever).

e.g. there's a few related mails on the archive (we should add this to the
FAQ)

http://www.mail-archive.com/[email protected]/msg00627.html
http://www.mail-archive.com/dom4j-user%40lists.sourceforge.net/msg00631.html

James


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to