Invalid URI: The Uri string is too long

后端 未结 1 1428
广开言路
广开言路 2020-12-20 12:36

I am trying to grab a schema and validate against my xml.

  XmlReaderSetting settings = new System.Xml.XmlReaderSettings();
            settings.Schemas.Add(         


        
相关标签:
1条回答
  • 2020-12-20 13:19

    the problem is that the xml in your xmlreader.create function should be a uri if the argument is a string.

    eg.

    XmlReader reader = XmlReader.Create("http://ServerName/data/books.xml", settings);
    

    In your case the xml file is being interpreted as the url and hence it is complaining about the limit.

    look at this msdn doc XmlReader.Create Method for different overloaded methods..

    I am guessing you should use the TextReader one.

    0 讨论(0)
提交回复
热议问题