Validating xml in c

Rated 3.80/5 based on 696 customer reviews

After setting the Validation Type property, the Schema's property and Validation Event Handler of the Xml Reader Settings object, we are ready to create a validating Xml Reader.

Create an Xml Reader that reads the file selected by the user from the txtfilename Text Box and validates it against the schema by calling the read method inside a whileloop.

This property sets the schema(s) used to validate the document read by the Xml Reader.

Register the method Validation Error with the settings object's Validation Event Handler.

Extensible Markup Language (XML) is used to describe data.

The code is pretty simple but I’m a fan of hiding away any complexities so that I don’t have to think about them when I’m working on a project.

You need one schema and two XML files to validate against the schema.

This program validates the XML document against the schema successfully.

XSD is a schema language; you use it to define the possible structure and contents of an XML format.

A validating parser can then check whether an XML instance document conforms to an XSD schema or a set of schemas.

Leave a Reply