Microsoft KB Archive/890945

= FIX: You receive an unexpected validation error message when you define a complex type with an &quot;xsd:any&quot; element declaration and an attribute of processContents=&quot;skip&quot; in the .NET Framework 1.1 =

Article ID: 890945

Article Last Modified on 4/7/2006

-

APPLIES TO


 * Microsoft .NET Framework 1.1

-





SYMPTOMS
In the Microsoft .NET Framework 1.1, you may define a complex type with an xsd:any element declaration and an attribute of processContents=&quot;skip&quot; that is similar to the following code sample.          You may also use an XMLValidatingReader method call (in the System.Xml namespace) to validate the following XML data against this schema:  Some value If you do this, you may receive the following error message:

Severity:Error Message : If the 'nillable' attribute is false in the schema, then the 'xsi:nil' attribute must not be present in the instance. An error occurred at, (x, y).



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version        Size       File name -  17-Dec-2004  03:05  1.1.4322.2057    573,440  System.web.services.dll 17-Dec-2004 03:05  1.1.4322.2057  1,355,776  System.xml.dll



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

MORE INFORMATION
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Steps to reproduce the behavior
<ol> <li> Save the following XML data as Test.xml. <root xmlns:xsi=&quot;http://www.proseware.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.proseware.org/2001/XMLSchema&quot;> <testfield xsi:nil=&quot;false&quot;>Some value </li> <li> Save the following XSD schema as Test.xsd in the same folder. <xsd:schema id=&quot;test1&quot; xmlns:xsd=&quot;http://www.proseware.org/2001/XMLSchema&quot;> <xsd:element name=&quot;root&quot;>   <xsd:any namespace=&quot;##any&quot; processContents=&quot;skip&quot; /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </li> <li> Save the following code sample as Class1.cs in the same folder. using System; using System.Xml; using System.Xml.Schema; using System.IO;

namespace Test {   ///     /// Summary description for Class1. ///    class Class1 {       ///         /// The main entry point for the application. ///        [STAThread] static void Main(string[] args) {           Class1 cls= new Class1; cls.validateXml; }       public void validateXml {           //The hard-coded path does not work either. FileStream stream = new FileStream(&quot;test.xml&quot;, FileMode.Open); try {               XmlValidatingReader reader= new XmlValidatingReader(stream, XmlNodeType.Document, null);

//Set the schema type as XSD schema. reader.ValidationType = ValidationType.Schema;

//Add the XSD to the schema collection of the reader. XmlSchemaCollection schemaCollection = reader.Schemas; schemaCollection.Add(&quot;&quot;,&quot;test.xsd&quot;);

//Set the event handler. reader.ValidationEventHandler += new ValidationEventHandler (ValidationHandler);

while(reader.Read); System.Console.WriteLine(&quot;Validation finished.&quot;); }           catch(XmlException ex) {               System.Console.WriteLine(&quot;XmlException : {0}&quot;, ex.ToString); }                       System.Console.Read; }       public static void ValidationHandler(object sender, ValidationEventArgs args) {           System.Console.WriteLine( &quot;***Validation error Severity:{0} Message : {1}&quot;, args.Severity,  args.Message); }   } } </li> <li>Compile the application by using the following command at the command prompt:

csc /r:System.Xml.dll Class1.cs

</li> <li>Run the application.

Note In the console window, you may receive the following error message:


 * Validation error Severity:

Error Message : If the 'nillable' attribute is false in the schema, then the 'xsi:nil' attribute must not be present in the instance.

An error occurred at, (1, 107).

Validation finished

</li></ol>

Keywords: kbqfe kbhotfixserver kbnetframe110presp2fix kbfix kbbug KB890945

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.