How do I validate an XML document against a DTD in C#?

前端 未结 4 1759
长发绾君心
长发绾君心 2021-01-05 07:21

I don\'t want to do anything fancy, I just want to make sure a document is valid, and print an error message if it is not. Google pointed me to this, but it seems XmlValidat

4条回答
  •  执念已碎
    2021-01-05 07:59

    I've referred to this example on DTD validation. https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmlreadersettings.dtdprocessing?view=netcore-3.1#input

    This example has invalid DTD XML, which I've corrected as below.

    
     
      
      
      
      
      ]>
    
      
        paint
        1
        16.95
      
    
    

提交回复
热议问题