static void Main(string[] args)
        {
            var schemaPath      = ConfigurationManager.AppSettings["xsdSchemaPath"];
            var schemaNamespace = ConfigurationManager.AppSettings["xsdSchemaNamespace"];
            var validator       = new XMLValidator(schemaPath, schemaNamespace);
            var validFilePath   = ConfigurationManager.AppSettings["validFile"];
            var invalidFilePath = ConfigurationManager.AppSettings["invalidFile"];

            Console.WriteLine("Valid file output\n");
            Console.WriteLine(validator.Validate(validFilePath));

            Console.WriteLine("\n \n-------------------------------------------------------------------------------------\n \n");

            Console.WriteLine("Invalid file output\n");
            Console.WriteLine(validator.Validate(invalidFilePath));

            Console.ReadKey();
        }
Esempio n. 2
0
        public static void ValidateXmlTest()
        {
            bool         isValid      = false;
            XMLValidator xmlValidator = new XMLValidator();

            isValid = xmlValidator.Validate(@"c:\temp\TestDataTable.xml", @"c:\temp\TestDataTable.xsd");
            if (isValid)
            {
                Program._messageLog.WriteLine("OK: Xml file has valid format.");
            }
            else
            {
                Program._messageLog.WriteLine("ERROR: Xml file does not have valid format.");
                Program._messageLog.WriteLine(xmlValidator.ValidationErrors);
            }
        }
Esempio n. 3
0
 public void XMLValidationReturnsMinusThreeIfDocumentDoesntMatchSchema()
 {
     Assert.That(XMLValidator.Validate(XMLStrings.xmlStringDoesntMatchSchema), Is.EqualTo(-3));
 }
Esempio n. 4
0
 public int ValidateXML(string xml)
 {
     return(XMLValidator.Validate(xml));
 }
Esempio n. 5
0
 public void XMLValidationReturnsExpectedCodes(string command, string siteId, int code)
 {
     Assert.That(XMLValidator.Validate(XMLStrings.xmlString(command, siteId)), Is.EqualTo(code));
 }