<small id='NGTVR'></small><noframes id='NGTVR'>

      <bdo id='NGTVR'></bdo><ul id='NGTVR'></ul>

      1. <i id='NGTVR'><tr id='NGTVR'><dt id='NGTVR'><q id='NGTVR'><span id='NGTVR'><b id='NGTVR'><form id='NGTVR'><ins id='NGTVR'></ins><ul id='NGTVR'></ul><sub id='NGTVR'></sub></form><legend id='NGTVR'></legend><bdo id='NGTVR'><pre id='NGTVR'><center id='NGTVR'></center></pre></bdo></b><th id='NGTVR'></th></span></q></dt></tr></i><div id='NGTVR'><tfoot id='NGTVR'></tfoot><dl id='NGTVR'><fieldset id='NGTVR'></fieldset></dl></div>

        <legend id='NGTVR'><style id='NGTVR'><dir id='NGTVR'><q id='NGTVR'></q></dir></style></legend>

        <tfoot id='NGTVR'></tfoot>

        无效的 URI:Uri 字符串太长

        时间:2023-06-04
      2. <small id='dQc9I'></small><noframes id='dQc9I'>

        <i id='dQc9I'><tr id='dQc9I'><dt id='dQc9I'><q id='dQc9I'><span id='dQc9I'><b id='dQc9I'><form id='dQc9I'><ins id='dQc9I'></ins><ul id='dQc9I'></ul><sub id='dQc9I'></sub></form><legend id='dQc9I'></legend><bdo id='dQc9I'><pre id='dQc9I'><center id='dQc9I'></center></pre></bdo></b><th id='dQc9I'></th></span></q></dt></tr></i><div id='dQc9I'><tfoot id='dQc9I'></tfoot><dl id='dQc9I'><fieldset id='dQc9I'></fieldset></dl></div>

              <legend id='dQc9I'><style id='dQc9I'><dir id='dQc9I'><q id='dQc9I'></q></dir></style></legend>
                <tbody id='dQc9I'></tbody>

                • <bdo id='dQc9I'></bdo><ul id='dQc9I'></ul>
                  <tfoot id='dQc9I'></tfoot>
                • 本文介绍了无效的 URI:Uri 字符串太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试获取架构并针对我的 xml 进行验证.

                   XmlReaderSetting settings = new System.Xml.XmlReaderSettings();settings.Schemas.Add(null, "http://example.com/myschema.xsd");settings.ValidationEventHandler += new System.Xml.Schema.ValidationEventHandler(settings_ValidationEventHandler);settings.ValidationType = ValidationType.Schema;settings.IgnoreWhitespace = false;XmlReader 阅读器 = XmlReader.Create(xml, settings);

                  我明白了

                  无效的URI:Uri字符串太长System.UriFormatException 未处理 Message=Invalid URI: Uri 字符串太长.源 = 系统堆栈跟踪:在 System.Uri.CreateThis(字符串 uri,布尔值 dontEscape,UriKind uriKind)在 System.Uri..ctor(字符串 uriString,UriKind uriKind)在 System.Xml.XmlResolver.ResolveUri(Uri baseUri,字符串 relativeUri)在 System.Xml.XmlUrlResolver.ResolveUri(Uri baseUri,字符串 relativeUri)在 System.Xml.XmlReaderSettings.CreateReader(字符串 inputUri,XmlParserContext inputContext)在 System.Xml.XmlReader.Create(字符串 inputUri,XmlReaderSettings 设置,XmlParserContext inputContext)在 System.Xml.XmlReader.Create(字符串 inputUri,XmlReaderSettings 设置)在 Program.cs:line 42 中的 ConsoleApplication2.Program.Main(String[] args)在 System.AppDomain._nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数)在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args)在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态)在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,布尔 ignoreSyncCtx)在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态)在 System.Threading.ThreadHelper.ThreadStart() 内部异常:

                  不告诉我最大长度是多少或任何东西.以前有人收到过这个吗?

                  解决方案

                  如果参数是字符串,问题是你的 xmlreader.create 函数中的 xml 应该是 uri.

                  例如.

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

                  在您的情况下,xml 文件被解释为 url,因此它抱怨限制.

                  看看这个 msdn 文档 XmlReader.Create 方法对于不同的重载方法..

                  我猜你应该使用 TextReader 之一.p>

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

                    XmlReaderSetting settings = new System.Xml.XmlReaderSettings();
                              settings.Schemas.Add(null, "http://example.com/myschema.xsd");
                              settings.ValidationEventHandler += new System.Xml.Schema.ValidationEventHandler(settings_ValidationEventHandler); 
                              settings.ValidationType = ValidationType.Schema;
                              settings.IgnoreWhitespace = false;
                              XmlReader reader = XmlReader.Create(xml, settings);
                  

                  I get

                  Invalid URI: The Uri string is too long
                  
                  
                  System.UriFormatException was unhandled   Message=Invalid URI: The Uri string is too long.   Source=System   StackTrace:
                         at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
                         at System.Uri..ctor(String uriString, UriKind uriKind)
                         at System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri)
                         at System.Xml.XmlUrlResolver.ResolveUri(Uri baseUri, String relativeUri)
                         at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
                         at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
                         at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings)
                         at ConsoleApplication2.Program.Main(String[] args) in Program.cs:line 42
                         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
                         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
                         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
                         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
                         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
                         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
                         at System.Threading.ThreadHelper.ThreadStart()   InnerException:
                  

                  Does not tell me what the max length is or anything. Anyone ever get this before?

                  解决方案

                  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.

                  这篇关于无效的 URI:Uri 字符串太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 XmlSerializer 反序列化大型文档中的节点 下一篇:XSD:使用 Visual Studio xsd.exe 不生成 Array[] 而不是

                  相关文章

                  最新文章

                  <tfoot id='yytFb'></tfoot>
                    <bdo id='yytFb'></bdo><ul id='yytFb'></ul>

                  <small id='yytFb'></small><noframes id='yytFb'>

                  1. <legend id='yytFb'><style id='yytFb'><dir id='yytFb'><q id='yytFb'></q></dir></style></legend>

                  2. <i id='yytFb'><tr id='yytFb'><dt id='yytFb'><q id='yytFb'><span id='yytFb'><b id='yytFb'><form id='yytFb'><ins id='yytFb'></ins><ul id='yytFb'></ul><sub id='yytFb'></sub></form><legend id='yytFb'></legend><bdo id='yytFb'><pre id='yytFb'><center id='yytFb'></center></pre></bdo></b><th id='yytFb'></th></span></q></dt></tr></i><div id='yytFb'><tfoot id='yytFb'></tfoot><dl id='yytFb'><fieldset id='yytFb'></fieldset></dl></div>