I brought this up a couple of months ago and submitted it as bug #1564. I suspect it
could
be causing some performance problems without people knowing it because if you don't
supply
an ErrorHandler, you won't even know that Xerces is generating a bunch of errors (due
to
not supplying a DTD).
We were able to work around the problem by creating a wrapper for the XMLReader, and
overriding the setFeature method and checking for the dynamic validation feature and
ignoring it when it is set. Keeping that feature from being activated did not seem to
have
any bad consequences.
-Chris
Gary L Peskin wrote:
> Scott et al --
>
> Thomas brings up a good point here. I'm not sure that we should always
> be setting dynamic validation on. It would be nice to have a switch in
> TransformerImpl or somewhere to turn this feature off.
>
> Thoughts?
>
> Gary
>
> [EMAIL PROTECTED] wrote:
> >
> > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2124
> >
> > *** shadow/2124 Tue Jun 12 07:06:17 2001
> > --- shadow/2124.tmp.13338 Wed Jun 13 00:05:46 2001
> > ***************
> > *** 39,41 ****
> > --- 39,81 ----
> > the problem? If so, what is the problem? Can you give an example?
> > Thanks,
> > Gary
> > +
> > + ------- Additional Comments From [EMAIL PROTECTED] 2001-06-13 00:05
>-------
> > + Hi,
> > + here is the piece of code from TransformerFactoryImpl.java, but the same is
> > + contained in other *.java files from the source:
> > +
> > + try
> > + {
> > + reader.setFeature("http://apache.org/xml/features/validation/dynamic",
> > + true);
> > + }
> > + catch (org.xml.sax.SAXException ex)
> > + {
> > +
> > + // feature not recognized
> > + }
> > +
> > + reader.setContentHandler(builder);
> > + reader.parse(isource);
> > + }
> > +
> > + And I have attched a little example test servlet, that I will explain now.
> > + Validation of the SAXParserFactory is set to true. For xerces the feature
> > + http://xml.org/sax/features/validation
> > + is set to true by its implementation of JAXP. I want to use it with XML Schema.
> > + But it does not work because you set the feature
> > + http://apache.org/xml/features/validation/dynamic to true as I mentioned above.
> > +
> > + Of course the bug is in Xerces because it fails with dynamic validation and XML
> > + Schema but the servlet works fine with Saxon because it does not set
> > + http://apache.org/xml/features/validation/dynamic to true.
> > +
> > + On the other hand, with such a SAXSource(XMLReader reader, InputSource) a
> > + validation always will take place even if there is only a DTD subset. And of
> > + course this will fail. And in my opinion it is not consitent with JAXP 1.1 Spec.
> > +
> > + Regards,
> > +
> > + Thomas
> > +