commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tal Dayan" <...@zapta.com>
Subject RE: [digester] forcing a specific DTD
Date Wed, 14 Nov 2001 07:57:46 GMT
Hi Jeff,

It worked as advertised in first try.

The API looks very flexible (e.g. generating a DOCTYPE based on the original
one) and it generated
the correct DOCTYPE in all cases I tried (with and without <? xml ... ?>,
with and without original
DOCTYPE, etc).

It seems like a very good workaround for the DTD enforcing issue and if the
license permits, we would like to use it. We have a wrapper class for the
Digester class so we just added to its constructor two new parameters, one
for the name of the root element and one for the URL of the DTD and now our
DTD is enforced in all cases and with minimum effort.

The only problem we have now is that when a DTD violation is detected in the
XML document, all we get is a log printout but the application is not aware
of the validation error and cannot for example throw and exception.

Thanks,

Tal

> -----Original Message-----
> From: Jeff Turner [mailto:jeff@socialchange.net.au]
> Sent: Tuesday, November 13, 2001 6:46 PM
> To: Jakarta Commons Developers List
> Subject: Re: [digester] forcing a specific DTD
>
>
> You can use this utility to force a specific doctype:
>
> http://newgate.socialchange.net.au/~jeff/doctypechanger/
>
> I posted this on Nov 5:
>
> http://marc.theaimsgroup.com/?l=jakarta-commons-dev&m=100491227030900&w=2
>
>
> --Jeff
>
> On Tue, Nov 13, 2001 at 09:04:43AM -0800, Tal Dayan wrote:
> >
> > We plan to use Digester for parsing XML based configuration
> files and would
> > like
> > to use a DTD to save some validation code. From the Digester
> documentation
> > it seems that the DTD based validation works as follows, the
> user specifies
> > an arbitrary DTD, and digester.parse() makes sure the XML
> document matches
> > the user's specified DTD.
> >
> > We have two problems with this approach:
> >
> > 1. When we parse a file, we know what DTD it should conform to
> so there is
> > not need require the user to type it (e.g. when Tomcat reads
> server.xml, the
> > user does not care about the DTD, it should be up to Tomcat to
> do the magic
> > of validating it).
> >
> > 2. The user can specify arbitrary DTD but we want to validate against a
> > *specific* DTD. It does not help us much if we know that the
> XML conforms to
> > some arbitrary DTD the user specified (this reminds me an old
> joke, a man is
> > asked by the bank manager to identify himself, he pull a
> picture of from his
> > pocket and says 'that's me').
> >
> > Any idea how to address these issues ?
> >
> > A good solution would be example a digester.forceSpecificDTD(...) method
> > that forces a specific DTD for that instance of the parser.
> This makes sense
> > since the digester is configured anyway (via the set of rules)
> to parse a
> > specific type of XML document.
> >
> > Thanks,
> >
> > Tal
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message