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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=77688 --- shadow/77688 2006-03-01 14:46:47.000000000 -0500 +++ shadow/77688.tmp.13022 2006-03-01 14:46:47.000000000 -0500 @@ -0,0 +1,138 @@ +Bug#: 77688 +Product: Mono: Class Libraries +Version: 1.1 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: Sys.XML +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Different AttributeType returned under Mono framework compared to Microsoft framework for XMLSchema.xsd. + +Description of Problem: + +Using the schema - http://www.w3.org/2001/XMLSchema.xsd and accessing the +'mixed' attribute for the complex type 'complexType', we get different +attribute types under Microsoft's framework compared to Mono. + +Unfortunately, I have been unable to produce a simplified test case using a +cut down schema, so the following test case uses the full schema. With a +cut down schema everything seems to work fine. + +Steps to reproduce the problem: + +using NUnit.Framework; +using System; +using System.IO; +using System.Xml; +using System.Xml.Schema; + +namespace XmlSchemaTests +{ + /// <summary> + /// Tests that the attribute 'mixed' has the correct data type/simple type + /// on the 'complexType' complex type from the actual schema for XML schemas + /// (http://www.w3.org/2001/XMLSchema.xsd). All these tests fail under +Mono 1.1. + /// </summary> + [TestFixture] + public class BooleanTypeAttributeTestFixture + { + XmlSchemaSimpleType simpleType; + XmlSchemaDatatype dataType; + + [SetUp] + public void Init() + { + StreamReader sr = new StreamReader("Schemas/XMLSchema.xsd", true); + XmlTextReader reader = new XmlTextReader(sr); + + // Remove the resolver do not get any errors about the XMLSchema.dtd +being missing. + reader.XmlResolver = null; + XmlSchema schema = XmlSchema.Read(reader, new +ValidationEventHandler(SchemaValidation)); + schema.Compile(new ValidationEventHandler(SchemaValidation)); + reader.Close(); + + XmlQualifiedName name = new XmlQualifiedName("complexType", +"http://www.w3.org/2001/XMLSchema"); + XmlSchemaComplexType complexType = FindNamedType(schema, name); + XmlSchemaComplexContent complexContent = complexType.ContentModel as +XmlSchemaComplexContent; + XmlSchemaComplexContentExtension extension = complexContent.Content as +XmlSchemaComplexContentExtension; + + XmlSchemaAttribute attribute = FindAttribute(extension.Attributes, "mixed"); + dataType = attribute.AttributeType as XmlSchemaDatatype; + simpleType = attribute.AttributeType as XmlSchemaSimpleType; + } + + [Test] + public void MixedAttributeDataTypeIsNotNull() + { + Assert.IsNotNull(dataType); + } + + /// <summary> + /// This test passes under Microsoft .NET 1.1, but fails under .NET 2.0. + /// </summary> + [Test] + public void MixedAttributeDataTypeIsBool() + { + Assert.IsTrue(dataType.ValueType == typeof(bool)); + } + + [Test] + public void MixedAttributeSimpleTypeIsNull() + { + Assert.IsNull(simpleType); + } + + /// <summary> + /// Look for the specified attribute in the schema objects. + /// </summary> + static XmlSchemaAttribute FindAttribute(XmlSchemaObjectCollection +schemaObjects, string name) + { + foreach (XmlSchemaObject schemaObject in schemaObjects) { + XmlSchemaAttribute attribute = schemaObject as XmlSchemaAttribute; + if (attribute != null) { + if (attribute.Name == name) { + return attribute; + } + } + } + return null; + } + + /// <summary> + /// Looks through the XmlSchema.Items for a complex type with the given name. + /// </summary> + static XmlSchemaComplexType FindNamedType(XmlSchema schema, +XmlQualifiedName name) + { + foreach (XmlSchemaObject schemaObject in schema.Items) { + XmlSchemaComplexType complexType = schemaObject as XmlSchemaComplexType; + if (complexType != null) { + if (complexType.QualifiedName == name) { + return complexType; + } + } + } + return null; + } + + void SchemaValidation(object source, ValidationEventArgs e) + { + // Do nothing. + } + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
