You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by md...@us.britannica.com on 2000/07/21 18:26:06 UTC

RE: Resubmitting: [PATCH] remove dynamic validation from DTMLiais on.j ava

Ugh, this is a problem for so many reasons.

Advantages to dynamic validation
--------------------------------
- The id function works.
- It might be easier to maintain, but only in a system that uses a
combination of validating documents and nonvalidating documents _with no
special characters_.

Disadvantages to dynamic validation
-----------------------------------
- The id function doesn't work.
- It's not correct default behavior in nonvalidating mode, and therefore it
introduces a performance cost hidden to the end user.  For example, users
may have a fully specified DTD but _not want to validate_ for performance
reasons.
- It produces many, many errors (at least 1 per element) for nonvalidating
documents with special characters.

Dynamic validating is especially a problem in my case, since I'm running
Xalan in a production servlet.  My log files would be pretty useless,
because every XSLT request will produce 50 or so errors from Xalan.  Of
course, I can keep patching Xalan with every release, since I don't use the
id function in production, but I'd prefer to see a fix merged into the code
base.

Rejecting this patch may be the best short term solution, but it leaves a
big problem.  In addition to the problem with the error messages, all those
requests are being slowed down, because they're needlessly undergoing
validation.  As I point out above, this also means that users with
validating DTDs may be getting an unexpected performance hit, because they
don't get error messages and therefore don't know that their documents are
being validated.  

I'm interested to hear some input from the Xerces group.  It's definitely a
problem in the XSLT world if you can't get the id of a node when validation
is disabled.  The id() function is not terribly useful in most environments;
it's a shame that you have to introduce all that validation overhead in
order to support it.

> -----Original Message-----
> From: Scott Boag/CAM/Lotus [mailto:Scott_Boag@lotus.com]
> Sent: Thursday, July 20, 2000 1:56 PM
> To: mdelagra@us.britannica.com
> Cc: xalan-dev@xml.apache.org; xerces-dev@xml.apache.org
> Subject: Re: Resubmitting: [PATCH] remove dynamic validation from
> DTMLiaison.j ava
> 
> 
> > Unfortunately, dynamic validation does work :) and causes 
> problems for
> > existing XML documents that worked in previous versions of Xalan.
> Dynamic
> > validation blindly enables validation whenever it 
> encounters a "DOCTYPE"
> > declaration.
> 
> The problem with commenting out dynamic validation is it will 
> make the id
> (...) functions fail... I talked to the Xerces folk, and, 
> while they do
> process entity refs and default attributes, they do not process ID
> declarations if validation is not run (I think this is the 
> wrong behavior,
> but that's something we need to discuss with the Xerces folk, 
> as they may
> well have good reasons for this).  With your patch, many of 
> our conformance
> tests failed that used the id(...) function.
> 
> I am unsure of where to go with this.  I am inclined to 
> reject the patch,
> on the basis of the id(...) function working being more 
> important.  On the
> other hand, I understand your problem.  Note that processing 
> still occurs
> (at least on the command line), even though validation errors 
> are reported.
> 
> I would like to get your opinion, given this additional 
> information, in
> addition to anyone else's opinion, before making a decision 
> on this patch
> for our next release.  Perhaps the Xerces folks have something to add?
> 
> On solution might be to add a third option that allows 
> dynamic validation
> to be controlled (with validation on by default).  This isn't really a
> solution, but at least it would provide a work-around.  This 
> is more work
> than I can do for this release, but we would be willing to 
> incorporate a
> patch that does this if someone does it fast.
> 
> -scott
> 
> 
> ----- Forwarded by Scott Boag/CAM/Lotus on 07/20/2000 12:51 PM -----
>                                                               
>                                                      
>                     Scott Boag                                
>                                                      
>                                          To:     
> xalan-dev@xml.apache.org                                          
>                     07/17/2000           cc:                  
>                                                      
>                     07:33 PM             Subject:     Re: 
> Resubmitting: [PATCH] remove dynamic validation from     
>                                          DTMLiaison.j 
> ava(Document link: Scott Boag)                               
>                                                               
>                                                      
> 
> 
> 
> Sorry for the delay.  We have about 8 patches backlogged which we are
> working on incorporating this week.  Myriam may have already 
> incorporated
> this particular patch today, I'm not sure.  We also need to 
> run our full
> regression suite on the patched code.
> 
> Our intention is to create our first patch-only release for Xalan 1.1,
> probably sometime next week.  If other's have patches, now's 
> the time to
> submit them!
> 
> BTW, this whole dynamic validation thing is tremendously 
> frustrating to me.
> The way it works seems to keep changing in Xerces.  I agree 
> with you about
> the dynamic validation being turned off by default, except I 
> would expect
> that entity decls and default attributes would still be 
> processed in this
> case... not sure about lately, but at least at the time I 
> wrote that code,
> that wasn't the case (maybe a bug?).  The bottom line is, the 
> processor
> should be able to process the document correctly without 
> having to know
> anything about the document (including entities and default attributes
> declared in the external doctype).  If, in the case you gave, 
> with dynamic
> validation turned off, the mdash entity does not get resolved, I would
> argue that dynamic validation should be on by default (I 
> agree with you
> that there should be an API method to control it).
> 
> -scott
> 
> 
> 
> 
>                                                               
>                                                         
>                     mdelagra@us.brit                          
>                                                         
>                     annica.com              To:     
> xalan-dev@xml.apache.org                                          
>                                             cc:     (bcc: 
> Scott Boag/CAM/Lotus)                                       
>                     07/17/2000 05:49        Subject:     
> Resubmitting: [PATCH] remove dynamic validation from         
>                     PM                      DTMLiaison.j ava  
>                                                         
>                     Please respond                            
>                                                         
>                     to xalan-dev                              
>                                                         
>                                                               
>                                                         
>                                                               
>                                                         
> 
> 
> 
> 
> 
> -----Original Message-----
> From: mdelagra@us.britannica.com [mailto:mdelagra@us.britannica.com]
> Sent: Thursday, July 13, 2000 9:22 AM
> To: xalan-dev@xml.apache.org
> Subject: [PATCH] remove dynamic validation from DTMLiaison.java
> 
> 
> Hi all,
> 
> Could a Committer please review and commit this patch?  Thanks.
> 
> 
> Index: DTMLiaison.java
> ===================================================================
> RCS file:
> /home/cvspublic/xml-xalan/src/org/apache/xalan/xpath/dtm/DTMLi
> aison.java,v
> retrieving revision 1.16
> diff -u -r1.16 DTMLiaison.java
> --- DTMLiaison.java       2000/05/26 05:50:21            1.16
> +++ DTMLiaison.java       2000/07/13 14:17:33
> @@ -225,11 +225,10 @@
> 
>          if(getUseValidation())
>            parser.setFeature("http://xml.org/sax/features/validation",
> true);
> -        else
> -        {
> -          // This doesn't seem to work, but I'm a setting it anyhow.
> -
> parser.setFeature("http://apache.org/xml/features/validation/dynamic",
> true);
> -        }
> +
> +        // "http://xml.org/sax/features/validation/dynamic" 
> is and should
> be false
> +        // by default.  It incorrectly decides to validate 
> documents that
> declare
> +        // internal entities.
> 
>          if(m_doThreading)
>          {
> 
> 
> 
> -----Original Message-----
> From: mdelagra@us.britannica.com [mailto:mdelagra@us.britannica.com]
> Sent: Tuesday, July 11, 2000 6:12 PM
> To: xalan-dev@xml.apache.org
> Subject: Bug in DTMLiaison.java concerning "dynamic validation"
> 
> 
> Hi all,
> 
> There is a significant bug in DTMLiaison, version 1.16.  
> Scott B. created
> the following block of code:
> 
>   if(getUseValidation())
>     parser.setFeature("http://xml.org/sax/features/validation", true);
>   else
>   {
>     // This doesn't seem to work, but I'm a setting it anyhow.
>     
> parser.setFeature("http://apache.org/xml/features/validation/dynamic",
> true);
>   }
> 
> Unfortunately, dynamic validation does work :) and causes problems for
> existing XML documents that worked in previous versions of 
> Xalan.  Dynamic
> validation blindly enables validation whenever it encounters 
> a "DOCTYPE"
> declaration.  This is not proper default behavior, because some XML
> documents perform nonvalidating resolution of special 
> characters in the
> DOCTYPE declaration.  For example, the current version of 
> Xalan attempts to
> validate this legal nonvalidating XML document:
> 
>    <?xml version="1.0" ?>
>   <!DOCTYPE article [
>     <!ENTITY mdash "&#151;">
>   ]>
> 
>   <article>
>     this is my mdash &mdash;
>   </article>
> 
> To make a long story short, dynamic validation should be 
> disabled.  The
> above code block should be replaced with this:
> 
>   if(getUseValidation())
>     parser.setFeature("http://xml.org/sax/features/validation", true);
> 
> You may want to include a method in the XMLParserLiaison that 
> allows a user
> to enable it explicitly, but it should be disabled by 
> default, as it is in
> Xerces.  In the current API, there is no way to turn off dynamic
> validation.
> That's bad.
> 
> Incidentally, I thought we were supposed to submit bugs to
> http://xml.apache.org/bugs, but I've never been able to gain 
> access.  Is
> the
> bug database only accessible to certain people?
> 
> Thanks!
> 
> Morgan Delagrange
> Britannica.com
> 
> 
> 
> 
>