Microsoft KB Archive/317415

= FIX: XmlSchema Object Incorrectly Permits Invalid Local Elements in an XSD Schema =

Article ID: 317415

Article Last Modified on 9/22/2003

-

APPLIES TO


 * Microsoft .NET Framework 1.0

-



This article was previously published under Q317415



SYMPTOMS
If an XSD schema has invalid local elements, the XmlSchema object loads the invalid elements as valid and does not generate an error.



RESOLUTION
When you write XSD schemas, make sure that they comply with World Wide Web Consortium (W3C) specifications. The W3C specification for XSD schemas is available at the following W3C Web site:

http://www.w3.org/TR/xmlschema-1



STATUS
This bug was corrected in Microsoft .NET Framework Class Libraries 1.1.



MORE INFORMATION
The W3C specification defines the XML schema definition language, which offers facilities for describing the structure and constraining the contents of XML 1.0 documents, including those that exploit the XML Namespace facility. The schema language, which is itself represented in XML 1.0 and uses namespaces, substantially reconstructs and extends the capabilities found in XML 1.0 document type definitions (DTDs). For more information, see the following W3C Web site:

http://www.w3.org/TR/xmlschema-1/#section-Element-Declaration-Validation-Rules

Steps to Reproduce the Behavior
  Paste the following XSD schema in a text file, and then save the file as C:\test.xsd: 

     



 </li> <li>Create a new Visual Basic Windows Application project.</li> <li>Drag a Button control from the toolbox to Form1.</li> <li> Paste the following code in the Click event of Button1: Dim fstream As New FileStream(&quot;C:\test.xsd&quot;, FileMode.Open) myschema = New XmlSchema myschema = XmlSchema.Read(fstream, Nothing) myschema.Compile(AddressOf ValidationEventHandler) MessageBox.Show(&quot;Completed Loading XSD Schema&quot;) </li> <li> Paste the following Sub routine: Public Sub ValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs) MsgBox(e.Message) End Sub </li> <li>Save and then run the project. You receive the message &quot;Completed Loading XSD Schema&quot;.

Note that the XSD schema has a element named &quot;test&quot; with a Abstract property that is set to &quot;true&quot;; according to W3C specifications for local elements, this should always be &quot;false&quot;.</li></ol>

Keywords: kbbug kbpending KB317415

-

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

© Microsoft Corporation. All rights reserved.