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/17 23:49:19 UTC

Resubmitting: [PATCH] remove dynamic validation from DTMLiaison.j ava


-----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/DTMLiaison.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