[Mono-bugs] [Bug 77685][Min] New - XmlSchemaAnnotation.Markup
returns null when the xs:documentation schema element is an
empty element
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Mar 1 14:09:12 EST 2006
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 matt.ward.bugs at googlemail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77685
--- shadow/77685 2006-03-01 14:09:12.000000000 -0500
+++ shadow/77685.tmp.12294 2006-03-01 14:09:12.000000000 -0500
@@ -0,0 +1,123 @@
+Bug#: 77685
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com
+ReportedBy: matt.ward.bugs at googlemail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: XmlSchemaAnnotation.Markup returns null when the xs:documentation schema element is an empty element
+
+Description of Problem:
+
+The XmlSchemaAnnotation.Markup property returns null when the
+xs:documentation schema element is an empty element. The Microsoft .NET
+frameworks 1.1 and 2.0 return an empty XmlNode array not null.
+
+An example schema:
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://go-mono.com/tests">
+ <xs:element name="choice">
+ <xs:annotation>
+ <xs:documentation
+ source="http://go-mono.com/tests/docs/#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+</xs:schema>
+
+
+
+Steps to reproduce the problem:
+
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+
+namespace XmlSchemaTests
+{
+ /// <summary>
+ /// Tests that the XmlSchemaAnnotation.Markup is not null when a schema has
+ /// annotation, but the documentation element is an empty element.
+ /// Under .NET 1.1 and .NET 2.0 this test passes, but under Mono 1.1 the
+markup
+ /// is null.
+ /// </summary>
+ [TestFixture]
+ public class SchemaAnnotationTestFixture
+ {
+ const string namespaceUri = "http://go-mono.com/tests";
+ XmlNode[] markupNodes;
+
+ [SetUp]
+ public void Init()
+ {
+ StringReader sr = new StringReader(GetSchemaXml());
+ XmlTextReader tr = new XmlTextReader(sr);
+
+ XmlSchema schema = XmlSchema.Read(tr, new
+ValidationEventHandler(SchemaValidation));
+ schema.Compile(new ValidationEventHandler(SchemaValidation));
+ tr.Close();
+
+ XmlQualifiedName name = new XmlQualifiedName("choice", namespaceUri);
+ XmlSchemaElement element = FindElement(schema, name);
+ XmlSchemaAnnotation annotation = element.Annotation;
+ XmlSchemaDocumentation doc = annotation.Items[0] as XmlSchemaDocumentation;
+ markupNodes = doc.Markup;
+ }
+
+ [Test]
+ public void MarkupIsNotNull()
+ {
+ Assert.IsNotNull(markupNodes);
+ }
+
+ /// <summary>
+ /// Finds an element in the XmlSchema.Elements.Values that matches the
+specified
+ /// name.
+ /// </summary>
+ static XmlSchemaElement FindElement(XmlSchema schema, XmlQualifiedName name)
+ {
+ foreach (XmlSchemaElement element in schema.Elements.Values) {
+ if (name == element.QualifiedName) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ string GetSchemaXml()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"
+elementFormDefault=\"qualified\"
+targetNamespace=\"http://go-mono.com/tests\">\r\n" +
+ "\t<xs:element name=\"choice\">\r\n" +
+ "\t\t<xs:annotation>\r\n" +
+ "\t\t\t<xs:documentation
+source=\"http://go-mono.com/tests/docs/#element-choice\"/>\r\n" +
+ "\t\t</xs:annotation>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+
+ void SchemaValidation(object source, ValidationEventArgs e)
+ {
+ // Do nothing.
+ }
+ }
+}
More information about the mono-bugs
mailing list