如何在W #c的C#wiht验证器Nu中使用RELAX NG模式验证XML文档?

时间:2015-07-22 15:03:36

标签: c# xml validation w3c relaxng

这是我在代码中发现的错误:

Invalid datatype was found for namespace 'http://whattf.org/datatype-draft' and local name 'string'.

这是我的代码段:

    RelaxngPattern g = Compile("C:\\nu\\validator-master\\validator-master\\schema\\html5\\xhtml5.rnc");

                        XmlTextReader xml_memori = new XmlTextReader(memStream);
                        RelaxngValidatingReader r= new RelaxngValidatingReader(xml_memori,g);
                        try
                        {
                            while (!r.EOF)
                                r.Read();
                        }
                        finally
                        {
                            r.Close();
                        }


 RelaxngPattern Compile(string file)
        {
            using (StreamReader sr = new StreamReader(file))
            {
                return Compile(sr, file);
            }
        }

        RelaxngPattern Compile(TextReader reader)
        {
            return Compile(reader, null);
        }

        RelaxngPattern Compile(TextReader reader, string baseUri)
        {
            RncParser parser = new RncParser(new NameTable());
            RelaxngPattern g = parser.Parse(reader, baseUri);
            g.Compile();
            return g;
        }

0 个答案:

没有答案