public void PostalZoneWithXPath() { SchematronValidator validator = new SchematronValidator("Schematron/Samples/PostalZone.sch"); XPathDocument instance = new XPathDocument("Schematron/Samples/PostalZone.ubl"); StringBuilder svrl = new StringBuilder(); ValidationReport report = new ValidationReport(validator, svrl); validator.Validate(instance); Console.WriteLine(svrl.ToString()); Assert.IsFalse(report.HasValidationErrors); }
public void IgnoreXpathErrors() { XmlDocument dogs = new XmlDocument(); dogs.LoadXml(@" <dogs> <dog petname='spot'><nose/><ear/><bone/><ear/></dog> <dog petname='hungry'><nose/><ear/><ear/></dog> <dog petname='smelly'><ear/><bone/><ear/></dog> </dogs>"); StringBuilder svrl = new StringBuilder(); SchematronValidator validator = new SchematronValidator("Schematron/Samples/DogXPathError.sch") { IgnoreQueryExpressionErrrors = true }; ValidationReport report = new ValidationReport(validator, svrl); validator.Validate(dogs); Assert.IsTrue(report.HasValidationErrors); }
public void PostalZone() { SchematronValidator validator = new SchematronValidator("Schematron/Samples/PostalZone.sch"); XmlDocument instance = new XmlDocument(); instance.Load("Schematron/Samples/PostalZone.ubl"); StringBuilder svrl = new StringBuilder(); ValidationReport report = new ValidationReport(validator, svrl); validator.Validate(instance); Console.WriteLine(svrl.ToString()); }