SYMPTOMS
When you validate an empty XML instance document by using
XmlValidatingReader, you may receive the following error message:
Element 'ElementName' has incomplete
content. Expected 'Employee'. An error occurred at file
:///FileName.
Where
ElementName
is the name of an empty element, and where
FileName
is the name of the XML instance document. You receive the error message even
though in the schema file, the element has the
nillable attribute set to
true, and has a complex content. Additionally, the empty element in
the instance document has the
nill attribute set to
true. The
XmlValidatingReader ignores the
nillable and
nill attributes, and throws the error.
REFERENCES
For additional information, click the following article
numbers to view the articles in the Microsoft Knowledge Base:
308064
HOW TO: Persist an ADO.NET DataSet as XML by Using Visual Basic .NET
309183 HOW TO: Persist an ADO.NET DataSet as XML by Using Visual C# .NET
317595 HOW TO: Validate an XML Document by Using Multiple Schemas in Visual Basic .NET
318505 HOW TO: Validate an XML Document by Using Multiple Schemas in Visual C# .NET
Idea Section
The sample code works in .NET Framework version 1.1 without
any change. Please add Microsoft .NET Framework Class Libraries 1.1 to the
applies to section after .NET Framework 1.1 is released.
Use contents of Article: 326604 BUG: XSD validation fails on the DataSet with empty table for writing this article