Пример #1
0
        private static XsdCheckResult CheckXsdFileMinOccursAtrribute(string xsdfilename)
        {
            XsdCheckResult res = new XsdCheckResult()
            {
                FilePath = xsdfilename
            };

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(xsdfilename);

                XmlNode root = doc.DocumentElement;

                var wrongMinOccursXpath = "//xs:element[@name='Extension' and (not(@minOccurs) or @minOccurs!='0')]";

                XmlNodeList nodeList = root.SelectNodes(wrongMinOccursXpath, GetXmlNamespaceManager(doc));

                foreach (XmlNode node in nodeList)
                {
                    res.ReportError(node.OuterXml);
                }
            }
            catch (Exception ex)
            {
                res.ReportError(ex.Message);
            }
            return(res);
        }
Пример #2
0
 private static void ReportError(this XsdCheckResult res, string errorDescription)
 {
     res.ErrorMessage += errorDescription + "\n\n";
     res.ErrorCount++;
 }