[Mono-bugs] [Bug 397612] New: Mutually exclusive behaviour between Mono and MS. NET for xs:import

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jun 5 14:39:03 EDT 2008


           Summary: Mutually exclusive behaviour between Mono and MS.NET for
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: james.fitzsimons at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

There is a mutually exclusive behaviour between Mono and MS.NET when a schema
references another schema using the xs:import syntax. This means that
applications that rely on this functionality (such as Spring.Net) aren't
portable across runtimes.

Scenario: You have and XmlSchemaSet that contains two schemas A & B and A
references B via an xs:import 

On Mono unless the schemaLocation attribute is supplied an
"System.Xml.Schema.XmlSchemaException : XmlSchema error: Required attribute
name must be present Related schema item SourceUri: ". For example:

System.Xml.Schema.XmlSchemaException : XmlSchema error: Referenced group
http://tempuri.org/importedNamespace.xsd:objectList was not found in the
corresponding schema. Related schema item SourceUri:
Line 15, Position 8.

On the MS.NET if the schemaLocation is supplied, an exception with the message
"The global element '{namespace:elementname}' has already been declared" is
For example: 

System.Configuration.ConfigurationErrorsException: Error creating context
'spring.root': The global element 'http://www.sprin

gframework.net:objects' has already been declared. --->
Spring.Util.FatalReflectionException: Cannot instantiate Type [Spring

Context.Support.XmlApplicationContext] using ctor [Void .ctor(System.String,
Boolean, System.String[])] : 'Exception has bee

n thrown by the target of an invocation.' --->
System.Reflection.TargetInvocationException: Exception has been thrown by the

target of an invocation. --->
Spring.Objects.Factory.ObjectDefinitionStoreException: Unexpected exception
parsing XML documen

t from config [spring/objects]Inner exception message= The global element
'http://www.springframework.net:objects' has alread

y been declared. ---> System.Xml.Schema.XmlSchemaValidationException: The
global element 'http://www.springframework.net:obje

cts' has already been declared.

e, XmlSeverityType severity)

System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(XmlSchemaException e)

   at System.Xml.Schema.XmlSchemaValidator.RecompileSchemaSet()

   at System.Xml.Schema.XmlSchemaValidator.Init()

   at System.Xml.Schema.XmlSchemaValidator..ctor(XmlNameTable nameTable,
XmlSchemaSet schemas, IXmlNamespaceResolver namespac

eResolver, XmlSchemaValidationFlags validationFlags)

On the MS.NET runtime omitting the schemaLocation works as expected. My
hypothesis is that they keep the schemas stored keyed by namespace and if they
encounter an import they check their cache by namespace to see if it already
exists in the set and if so use that.

The W3C documentation (http://www.w3.org/TR/xmlschema-0/#schemaLocation) states
that schemaLocation attribute is optional, which seems a further argument for
changing this behaviour in Mono.

I propose a change to Monos behaviour such that if the schemaLocation is
omitted it checks the other schemas in the schema set for a match by namespace
first before throwing an exception. This would make it functionally equivalent
to the MS.NET implementation and bring it inline with the W3C documentation.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list