[Mono-bugs] [Bug 58818][Nor] New - XmlValidatingReader fails validation against extended XHTML DTD (different from bug 51495)
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 21 May 2004 16:58:01 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by biomech@uscm.net.
http://bugzilla.ximian.com/show_bug.cgi?id=58818
--- shadow/58818 2004-05-21 16:58:00.000000000 -0400
+++ shadow/58818.tmp.4379 2004-05-21 16:58:01.000000000 -0400
@@ -0,0 +1,149 @@
+Bug#: 58818
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: biomech@uscm.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: XmlValidatingReader fails validation against extended XHTML DTD (different from bug 51495)
+
+Description of Problem:
+In Mono beta 1, extending the XHTML 1.1 DTD (as per Modularization of XHTML
+w3c recommendataion) by removing the inline style module results in a
+System.Xml.XmlException. This exception does not occur in Microsoft.NET
+framework 1.1.
+
+NOTE: This is NOT the same as bug 51495. Validation against
+xhtml11-flat.dtd does in fact work. This new bug shows up when validating
+against a custom DTD that derives from xhtml11-flat.dtd with the inline
+style module removed.
+
+NOTE: I tried removing the following other modules from xhtml11 dtd without
+any exceptions... it appears to only happen for inline style module:
+events, edit, bdo, ruby, style, ssismap, param, object, form
+
+Steps to reproduce the problem:
+1. Create a custom DTD (i.e. XHTMLSubSet.dtd):
+
+<!ENTITY % xhtml-inlstyle.module "IGNORE" >
+<!ENTITY % xhtml11.mod
+ PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11-flat.dtd" >
+%xhtml11.mod;
+
+2. Create an XML file to validate (i.e. XHTMLSubSet.xml):
+
+<?xml version="1.0" ?>
+<!DOCTYPE html SYSTEM "XHTMLSubSet.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>XHTMLSubSetTest</title>
+ </head>
+ <body>
+ <p style="display:none">XHTML Sub Set Test</p>
+ </body>
+</html>
+
+
+3. Create a program to validate the XML document (XHTMLSubSetTest.cs)
+
+using System;
+using System.Xml;
+
+class XHTMLSubSetTest
+{
+ public static void Main(string[] args)
+ {
+ XmlDocument doc = new XmlDocument();
+ XmlTextReader tr = new XmlTextReader("XHTMLSubSet.xml");
+ XmlValidatingReader vr = new XmlValidatingReader(tr);
+ doc.Load(vr);
+ }
+}
+
+4. Compile and run the program.
+
+
+Actual Results:
+
+(from Mono beta 1)
+
+Unhandled Exception: System.Xml.XmlException: Expected >, but found d[100]
+in <0x00170> System.Xml.DTDReader:ExpectAfterWhitespace (char)
+in <0x00418> System.Xml.DTDReader:ReadAttListDecl ()
+in <0x00381> System.Xml.DTDReader:CompileDeclaration ()
+in <0x001e4> System.Xml.DTDReader:ProcessDTDSubset ()
+in <0x0013f> System.Xml.DTDReader:ProcessDTDSubset ()
+in <0x00292> System.Xml.DTDReader:GenerateDTDObjectModel ()
+in <0x0020e> System.Xml.XmlTextReader:GenerateDTDObjectModel
+(string,string,string,string,int,int)
+in <0x002fc> System.Xml.XmlTextReader:ReadDoctypeDecl ()
+in <0x000bd> System.Xml.XmlTextReader:ReadDeclaration ()
+in <0x0008e> System.Xml.XmlTextReader:ReadTag ()
+in <0x000df> System.Xml.XmlTextReader:ReadContent ()
+in <0x00195> System.Xml.XmlTextReader:Read ()
+in <0x0034d> Mono.Xml.DTDValidatingReader:ReadContent ()
+in <0x017bb> Mono.Xml.DTDValidatingReader:ReadContent ()
+in <0x000c2> Mono.Xml.DTDValidatingReader:Read ()
+in <0x000bc> Mono.Xml.Schema.XsdValidatingReader:Read ()
+in <0x002ff> System.Xml.XmlValidatingReader:Read ()
+in <0x007db> System.Xml.XmlDocument:ReadNode (System.Xml.XmlReader)
+in <0x0004f> System.Xml.XmlDocument:Load (System.Xml.XmlReader)
+in <0x00088> XHTMLSubSetTest:Main (string[])
+
+
+Expected Results:
+
+(from Microsoft.NET 1.1) - an exception should be thrown indicating that
+the style attribute is not valid in the redefined DTD (as follows):
+
+Unhandled Exception: System.Xml.Schema.XmlSchemaException: The 'style'
+attribute is not declared. An error occurred at
+file:///D:/Personal/Dev/XHTMLSubSetTest/XHTMLSubSet.xml, (8, 10).
+ at System.Xml.XmlValidatingReader.InternalValidationCallback(Object
+sender, ValidationEventArgs e)
+ at System.Xml.Schema.Validator.SendValidationEvent(XmlSchemaException e,
+XmlSeverityType severity)
+ at System.Xml.Schema.Validator.ProcessElement()
+ at System.Xml.Schema.Validator.Validate()
+ at System.Xml.Schema.Validator.Validate(ValidationType valType)
+ at System.Xml.XmlValidatingReader.ReadWithCollectTextToken()
+ at System.Xml.XmlValidatingReader.Read()
+ at System.Xml.XmlLoader.LoadCurrentNode()
+ at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
+ at System.Xml.XmlLoader.LoadElementNode()
+ at System.Xml.XmlLoader.LoadCurrentNode()
+ at System.Xml.XmlLoader.LoadCurrentNode()
+ at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
+ at System.Xml.XmlLoader.LoadElementNode()
+ at System.Xml.XmlLoader.LoadCurrentNode()
+ at System.Xml.XmlLoader.LoadCurrentNode()
+ at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
+ at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
+preserveWhitespace)
+ at System.Xml.XmlDocument.Load(XmlReader reader)
+ at XHTMLSubSetTest.Main(String[] args)
+
+How often does this happen?
+
+This appears to only happen when redefining the xhtml11-flat DTD to exclude
+the inline style module (not every module was tested however). In that
+situation, the failure occurs every time the program is run.
+
+Additional Information:
+
+While it has no effect on the bug, for completeness, removing the style
+attribute from the <p> tag and running the example still results in a
+failure in mono while Microsoft.NET 1.1 completes successfully.
+
+I was hoping to use this technique (extending XHTML) to validate user input
+against a restricted subset of XHTML.