Xmlvalidatingreader c example
Use the Schemas property to have the reader validate by using schema files that are cached in an Xml Schema Collection. Xml Validating Reader throws an Xml Exception on XML parse errors. IXml Namespace Resolver implements the Xml Reader class and provides support for data validation.
(Inherited from Xml Reader) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a double-precision floating-point number.Here is my code: Public Shared Function Validate XMLSchema(By Val p XMLFile As String, p Schema Path As String) As String Dim tr As Xml Text Reader Dim xsc As Xml Schema Collection Dim vr As Xml Validating Reader Dim str Return As String = "" 'Read the XML schema with the text reader and add it to a schema collection tr = New Xml Text Reader(New Stream Reader(p Schema Path)) xsc = New Xml Schema Collection xsc. Add(Nothing, tr) 'Create a Validating Reader and add the XMLSchema Collection. However, we recommend that you use the Read Element Content As String() method instead, because it provides a more straightforward way to handle this operation.(Inherited from Xml Reader) Checks that the Name property of the element found matches the given string before reading a text-only element.