Validation of xml with xmlvalidatingreader example

08 Feb

For more information about XML, see the World Wide Web Consortium (W3C) Extensible Markup Language (XML) 1.0 (Second Edition) Recommendation located at

Given the increasing importance of XML in all areas of programming and data processing, the inclusion of powerful, integrated XML support in . This is a new language introduced with Visual Studio . Previous development tools, exemplified by Visual Studio version 6.0, were designed for the needs of a decade ago, when the ruling paradigm was applications that were stand-alone or were distributed over a local area network (LAN). NET Framework provides a comprehensive set of classes that are designed for just about any programming task you can imagine.

As the need for Web-related capabilities grew, ad hoc solutions were crafted as enhancements to existing tools. From the very beginning, the Framework was designed to integrate Web-related programming functionality.

XML Schema definition language (XSD) schema validation is implemented using the validity constraints defined in the World Wide Web Consortium (W3C) XML Schema Recommendation. NET Framework supports the W3C XML Schema 2001 Recommendation. Each XML Schema is associated with a namespace URI.

The Xml Validating Reader can use the XML Schema (XSD) schema Location attribute in the data file that is bound to the XML Schema instance namespace,

Some observers consider C# to be a Java replacement made necessary because legal problems have forced Microsoft to stop supporting Java (or Visual J , as Microsoft's version of Java was called). NET was designed to support XML from the ground up. There are no add-ons required, such as the MSXML Parser or the SOAP Toolkit. If the schema is stored in an Xml Schema Collection, the Xml Validating Reader uses the namespace URI specified when the schema was added to the collection.This is typically the target namespace of the schema.Utlimately I want to be able to parse an xml STRING with an xsd STRING but this is the best I could do: parsing an xml FILE with an xsd FILE. I basically reworked a console application example in the MSDN help file into a nicer looking ASP. It tells you if your file is not well-formed and then if it is not valid it lists out the specific reason (like in XMLSpy), quite helpful to find an error in a large XML file as it returns the line number on which the error occurred as well as the tag name. NET so to get it to work you will have to change the code around to whatever you want to do. Any properties set on the supplied Xml Text Reader also apply to the containing Xml Validating Reader.The following code example shows the Xml Validating Reader layering support over the Xml Text Reader.