예제 #1
0
        public void ConvertXmlToRss(string xmlFile, string schemaUri, string targetNamespace, out bool isConversionSuccessful, string userErrorFile = "")
        {
            if (!XmlValidator.IsXmlValid(@"..\..\..\books.xml", @"..\..\..\books.xsd", "http://library.by/catalog", @"..\..\..\error.txt"))
            {
                isConversionSuccessful = false;
                return;
            }

            isConversionSuccessful = true;
        }
예제 #2
0
        static void Main(string[] args)
        {
            string xmlPath = Path.GetFullPath("/users/ruy/Documents/Training/XML/input.xml");
            string xsdPath = Path.GetFullPath("/users/ruy/Documents/Training/XML/validationSchema.xsd");

            XElement  inputXml    = XElement.Load(xmlPath);
            XDocument xmlDocument = new XDocument(inputXml);

            StringReader xmlSchemaDefinition = new StringReader(File.ReadAllText(xsdPath));

            XmlValidator xmlValidator = new XmlValidator();

            var isXmlValid = xmlValidator.IsXmlValid(xmlDocument, xmlSchemaDefinition);
        }
예제 #3
0
 public void TestMethod1()
 {
     Assert.IsTrue(XmlValidator.IsXmlValid(@"..\..\..\books.xml", @"..\..\..\books.xsd", "http://library.by/catalog", @"..\..\..\error.txt"));
 }