This documentation is archived and is not being maintained.

Checking for Well-Formed and Valid XML

Visual Studio .NET 2003

There are two inherently different ways to verify whether XML files are coded correctly. All XML files must be well formed, and if an XML file has an associated schema, then the structure and content must also be deemed valid.

  • Well-formed – The XML code must be syntactically correct or the XML parser will raise an error.
  • Valid – If the XML file has an associated XML Schema, the elements must appear in the defined structure and the content of the individual elements must conform to the declared data types specified in the schema.

The XML Designer can be used to verify that XML files are both well formed and valid.

To check for well-formed or valid XML

Note   In order to check that XML files are valid, they must have an associated XML Schema. For more information on associating a schema with your XML file, see Assigning Schemas to XML Files.
  1. Load the XML file you want to check into the XML Designer.
  2. From the XML menu select Validate XML Data.
  3. The status bar will indicate if errors were found in your XML file.
  4. If errors were found, view the Task List For more information.

See Also

XML Files | Creating New XML Files | Assigning Schemas to XML Files | Creating XML Schemas from XML Files | Relational Data in XML Schemas | Creating XML Schemas and Datasets | Introduction to Data Access with ADO.NET | Introduction to Datasets

Show: