Xmlvalidatingreader class

Rated 3.82/5 based on 824 customer reviews

The resolver code never gets called and the validation does not occur at all. Is that a bug and there is no way to enforce the DTD even if the icoming XML file does not specify the DTD file? You can add Doctype to a document using a variety of methods.

Because of that I would like to see MS actually provide some workaround for this issue. "Kevin Yu [MSFT]" node into the document using XSLT and validate the Xml Document.Something like this: Xml Reader r = new Xml Text Reader("foo.xml"); Xml Writer w = new Xml Text Writer("foo2.xml", Encoding. Close(); Xml Validating Reader vr = new Xml Validating Reader(new Xml Text Reader("foo2.xml")); while (vr.UTF8); bool has Doctype = false, in Prolog = true; while (r. Read()); -- Oleg Tkachenko [XML MVP] it's an interesting idea to check the file twice in case the Document Type is null I would rather see if there is any other way to do it.UTF8); bool has Doctype = false, in Prolog = true; while (r. Read()); -- Oleg Tkachenko [XML MVP] Oleg for your suggestion. "Oleg Tkachenko [MVP]" While it's an interesting idea to check the file twice in case the Document Type is null I would rather see if there is any other way to do it.There is still a permance hit though because I still have read the whole source file into a new file before reading the new file again using the validating reader. As was seen in Oleg's reply the custom validator could be one of the solutions since the XSLT would give me a substantial performance hit for large files (which I get a lot of). The problem is in tight coupling between Xml Validating Reader and Xml Text Reader - Xml Validating Reader requires Xml Text Reader as input reader (which is a well known bug).

Leave a Reply