Bug 19409 - XmReader schema validation fails with <xsd:any processContents="skip">
Summary: XmReader schema validation fails with <xsd:any processContents="skip">
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-04-30 06:42 UTC by k.olbrich
Modified: 2015-03-17 16:18 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description k.olbrich 2014-04-30 06:42:11 UTC
Validating System.XmlReader.Read() fails with an schema validation exception, if the processContents="lax" attribute is specified in the <xsd::any/> tag within the xsd schema. The schema file itself is proofed to be OK (official ETG EtherCAT schema "EtherCATBase.xsd") and works also with MSVC 2010.

<xs:complexType name="VendorSpecificType">
<xs:sequence>
<!--xs:any namespace="##any" processContents="skip" maxOccurs="unbounded"/-->
<xs:any namespace="##any" processContents="lax" maxOccurs="unbounded"/> <!-- Workaround for Mono. Mono has problems with "skip" -->
</xs:sequence>
</xs:complexType>

E.g. parsing the following part of an XML file:
					<VendorSpecific>
						<TwinCAT>
						</TwinCAT>
					</VendorSpecific>
				</Info>
				<GroupType>DigOut</GroupType>

causes...:

System.Xml.Schema.XmlSchemaValidationException: XmlSchema error: Invalid start element: :GroupType XML  Line 2529, Position 6.
  at System.Xml.XmlReaderSettings.OnValidationError (System.Object o, System.Xml.Schema.ValidationEventArgs e) [0x00000] in <filename unknown>:0 
  at Mono.Xml.Schema.XmlSchemaValidatingReader+<XmlSchemaValidatingReader>c__AnonStorey0.<>m__1 (System.Object o, System.Xml.Schema.ValidationEventArgs e) [0x00000] in <filename unknown>:0 
  at System.Xml.Schema.XmlSchemaValidator.HandleError (System.Xml.Schema.XmlSchemaValidationException exception, Boolean isWarning) [0x00000] in <filename unknown>:0 
  at System.Xml.Schema.XmlSchemaValidator.HandleError (System.String message, System.Exception innerException, Boolean isWarning) [0x00000] in <filename unknown>:0 
  at System.Xml.Schema.XmlSchemaValidator.HandleError (System.String message) [0x00000] in <filename unknown>:0 
  at System.Xml.Schema.XmlSchemaValidator.ValidateStartElementParticle (System.String localName, System.String ns) [0x00000] in <filename unknown>:0 
  at System.Xml.Schema.XmlSchemaValidator.AssessOpenStartElementSchemaValidity (System.String localName, System.String ns) [0x00000] in <filename unknown>:0 
  at System.Xml.Schema.XmlSchemaValidator.ValidateElement (System.String localName, System.String namespaceUri, System.Xml.Schema.XmlSchemaInfo schemaInfo, System.String xsiType, System.String xsiNil, System.String xsiSchemaLocation, System.String xsiNoNamespaceSchemaLocation) [0x00000] in <filename unknown>:0 
  at Mono.Xml.Schema.XmlSchemaValidatingReader.Read () [0x00000] in <filename unknown>:0 
  at Mono.Xml.XmlFilterReader.Read () [0x00000] in <filename unknown>:0
Comment 1 k.olbrich 2014-04-30 06:48:01 UTC
Actually processContents="skip" fails, not "lax". "lax" is a workaround.
Comment 2 k.olbrich 2014-04-30 06:53:13 UTC
Some additional infos. It is .NET framework 4.0, client profile. The assemblies are compiled in MS Visual Studio 2010.
Comment 3 Atsushi Eno 2015-03-17 16:18:12 UTC
Since we imported referencesource for System.Xml.Schema, it should be compatible with .NET now.