You must Sign In to post a response.
  • Category: XML

    How to check the file validation..?

    how to check the xml file is validate or not

    string[] files = Directory.GetFiles(@"A:\\123", "*.xml", SearchOption.AllDirectories);

    how to check the xml file of files[0] is valid or not ......
  • #740638
    Validates the XmlDocument against the XML Schema Definition Language schemas contained in the Schemas property.You will find the article on your topic at

  • #740670
    in what sense you want to validate it ? want to parse it against XML schema then you can use following code link
    you can use XMLReader for xml parsing.
    you want to check the formatting of XML, then you can use XMLDocumentClass and use 'load' method
    see below code snippet

    XMLDocument xmlDom;
    xmlDom = new XMLDocument();
    xmlDom.load("XMl file path");
    //xml parse successfully
    Catch(Exception ex)
    //xml is not parsed successfully
    xmlDom = null;

    hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments