Aziz Qureshi
Aziz Qureshi

Reputation: 279

linq to xml validation against a DTD file in c#

I have a xml file that has

I am using linq to xml for parsing this xml. I have searched for validation of xml in linq to xml and most of the examples I get are validation against a xsd file.

Can please anyone tell me how to use linq to xml for validation against a DTD file.

Thanks.

Much obliged

Upvotes: 0

Views: 635

Answers (1)

D Stanley
D Stanley

Reputation: 152624

From the documentation for XDocumentType:

LINQ to XML will not validate a document against a DTD, but you can use a validating XmlReader to perform DTD validation if necessary.

So it sounds like you'll need to validate the Xml using an XmlReader before trying to read it using Linq to XML

Upvotes: 1

Related Questions