Xmlvalidatingreader is obsolete

Edit: I'm trying Mehrdad's tip, but I'm having trouble. Validation Event Handler = new Validation Event Handler(/*trouble is here*/); Xml Reader validating Reader = Xml Reader.

I think I've got most of it, but I can't find On Validation Event anywhere. Xml Reader Settings settings = new Xml Reader Settings(); settings.

I am trying to find an alternative to the following function, which is using the obsolete How can I adapt this code to work with XMLReader, which is what Visual Studio is suggesting as an alternative? 'VALIDATE XML Public Shared Function validate Xml(By Val xml String As String) As Xml Document xml Error Str = "" Dim str Reader As New String Reader(xml String) Dim xmlr As New Xml Text Reader(str Reader) Dim xmlvread As New Xml Validating Reader(xmlr) ' Set the validation event handler Add Handler xmlvread.

The xml String I am passing into the function is the raw xml which is referencing the XSD schema.

Line numbers are maintained only for element nodes; the line number returned for any other node will be that of the most recent element.

xml Document = new Xml Document(); xml Text Reader = new Xml Text Reader(file Info. Settings = new Xml Reader Settings(); xml Text Reader. Max Characters From Entities = 0; var vr = new Xml Validating Reader(xml Text Reader); vr. Load(uri) ********** Via XDocument, then XMLDocument ********** Via Xml Document. To enable DTD proce ssing set the Prohibit Dtd property on Xml Reader Settings to false and pass the se ttings into Xml Reader. To enable DTD proce ssing set the Prohibit Dtd property on Xml Reader Settings to false and pass the se ttings into Xml Reader. Create For security reasons DTD is prohibited in this XML document. Create with settings For security reasons DTD is prohibited in this XML document.If this property is set, and if schema validation is requested, then validation will fail unless the outermost element of the document has the required name.This option requires the schema-aware version of the Saxon product (Saxon-SA).

Search for xmlvalidatingreader is obsolete:

xmlvalidatingreader is obsolete-51xmlvalidatingreader is obsolete-62

I think my problem is setting up the readers and the input streams. Source Uri = xsd_file; Xml Schema Set ss = new Xml Schema Set(); ss. Source Uri = xsd_file; Xml Schema Set ss = new Xml Schema Set(); ss.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “xmlvalidatingreader is obsolete”