PRB: "Schema Validation Warning" When You Generate a Managed Class for XML Schema with an any Element Declaration and a Local Element Declaration (815108)
The information in this article applies to:
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# .NET (2003)
- Microsoft Visual C# .NET (2002)
SYMPTOMSWhen you create an XML Schema that contains an any element without a namespace declaration, or if the value for the namespace
is set to any value other than ##other and ##local along with a local
element declaration, you may receive the following warnings when you generate managed classes for the schema by using the XML
Schema Definition Tool (Xsd.exe): Schema
validation warning: The content model must be deterministic. Wildcard dec
laration along with a local element declaration causes content model to become
a mbiguous. An error occurred at file:Filename.xsd(Line, Column). Warning:
Schema could not be validated. Class generation may fail or may produce
incorrect results. CAUSEThe any element permits any element from the specified namespace to appear in the
containing sequence or the choice element. Xsd.exe does not support the namespace for the any element and the warning messages display when you generate managed classes. WORKAROUNDTo work around this problem, do not declare local elements
when you declare an any element. When you set the value for the namespace for the any element as "##other" or "##local", you may not get warnings when you generate managed classes. However, when you build a library for the generated
managed class and then generate schema from the library by using XSD.exe, you may
not get the namespace declaration in the generated schema. For more
information about XML Schema design patterns, visit the following MSDN Web
site:
STATUS This
behavior is by design.REFERENCES
For additional information about XML Schemas in the Microsoft .NET Framework, click the following article number to view the article in the Microsoft Knowledge Base:
313826
INFO: Roadmap for XML Schemas in
the .NET Framework
Modification Type: | Major | Last Reviewed: | 9/19/2003 |
---|
Keywords: | kbCodeGen kbXML kbSchema kbprb KB815108 kbAudDeveloper |
---|
|