问题标签 [xmlexception]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
web-services - Invoke of ASMX webmethod fails with XMLException but works without an ASP.Net client
When I test my webservice from my development webserver (screen below) I click the INVOKE button and a new window opens, prompts for OPEN or SAVE, and the application associated with the filetype opens the file in the window.
Hoping this will work when the ColdFusion(CF) developers call the webmethod, I tried to simulate the CF test by adding a few lines of code into my .Net webclient to call the same webmethod:
Using this ASP.Net page as a caller, I get a very strange error (see below). Please note in the StackTrace where DownloadCF method is followed by the SoapHttpClientProtocol.Invoke method and the error. I don't see why one approach fails while the other Invoke works properly.
Server Error in '/sdkTrimFileServiceASMXclient' Application.
-----EDIT/UPDATE: Session Info from Fiddler2 There is one session to get this started. Result code is 200. WebView tab in the response looks exactly like my webclient page. When the button is clicked, I get one and only one new session in Fiddler2 pasted here:
What follows is a paste of the Raw request for that session (ugly but how else to tell it?): POST http://mdwdata/sdkTrimFileServiceASMXclient/launcher.aspx HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, / Referer: http://mdwdata/sdkTrimFileServiceASMXclient/launcher.aspx Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; InfoPath.3) Content-Type: multipart/form-data; boundary=---------------------------7db1e23703ae Accept-Encoding: gzip, deflate Host: mdwdata Content-Length: 2844 Connection: Keep-Alive Pragma: no-cache
The corresponding Response from that session from Fiddler2 is simply an HTML page with a bunch of styling followed by the Stack Trace from the XML exception (Data at the root level is invalid. Line 1, position 1.) The stack trace is in the original post above so won't repeat it here.
I have a theory about what could be wrong but I really hesitate in making my updated post any longer (I am thinking about opening new question and referencing this as background info). Suggestions?
c# - XmlDocument.Load 失败,LoadXml 工作:
在回答这个问题时,我遇到了一个我不明白的情况。OP 试图从以下位置加载 XML:http ://www.google.com/ig/api?weather=12414&hl=it
显而易见的解决方案是:
然而,这失败了
XmlException : 给定编码中的无效字符。第 1 行,位置 499。
它似乎在窒息à
。Umidità
OTOH,以下工作正常:
我对此感到困惑。谁能解释为什么前者失败,但后者工作正常?
值得注意的是,文档的 xml 声明省略了编码。
java - xmlbeans.xml 异常。非法 XML 字符 0x0
我通过 System.Text.UTF8Encoding() 将字符串转换为字节,在 C# 中创建了一个 xml 文档。然后我将它发送到我的 java 程序,以便 xmlbeans 通过 TCP 连接进行解析。无论我尝试什么,我都会收到此错误:org.apache.xmlbeans.XmlException: error: Illegal XML character: 0x0 org.apache.xmlbeans.impl.piccolo.io.IllegalCharException: Illegal XML character: 0x0
我试图清理 C# 端的字符串,但它没有找到 0x0 的任何实例。我已经循环并输出了我在 java 端收到的 byte[] 中的每个字节,并且绝对没有任何内容具有 0x0。
这是我的java端代码:
有谁知道我可能做错了什么?我可以提供更多信息吗?
android - Android 中的 XmlPullParser 问题
因此,在查看代码时,读取 xml 时不会引发异常......工作正常。
问题出在 doXML 方法中,我试图在其中读取文本 b/w 两个标签...例如。
生成的错误是 18:19:41.654: W/System.err(329): org.xmlpull.v1.XmlPullParserException: name expected (position:START_TAG @59:57 in java.io.InputStreamReader@44f049c8)
我认为代码可能比它需要的更复杂......但无法找出错误。谢谢
php - 带有 JavaScript Extjs 的 PHP 文件
这里是一个新手程序员的菜鸟问题。
我正在尝试在 .php 文件中执行 javascript,在我的索引中包含以下行:
在我的 basic.php 中:
它不断发送错误消息:
SyntaxError: XML 表达式中缺少 }
c# - XmlDocument from XML string that contains custom namespaces causes XmlException?
I need to create an XmlDocument partly by using old XML and partly by creating new. The problem is that the old XML contains custom namespaces and I can't seem to be able to use them as I get an XmlException. I've tried to add the namespace to many different places but I can't get over the Exception!
The Exception
My Code
Input from Item.Body is similar to
I expected the output to be similar to
I'm open to alternatives to using this method. After I create the XmlDocument I prettyprint it, validate it against a schema and then push it out for the user to see.
c# - WCF 反序列化中的 XmlException:“名称不能以 '<' 开头”-在自动属性支持字段中
我今天开始在 WCF 反序列化中遇到错误 - 代码一直没有改变并且工作了几个月。
问题是我得到运行时XmlException
说'名称不能以'<'字符'开头。我已经调试到 .NET 源代码,似乎错误在于反序列化来自 WCF 服务调用的返回对象。这些对象是使用自动属性定义的,似乎支持字段的名称类似于<MyProperty>k_BackingField
,这就是 XmlException 的来源。
我在网上看到了其他一些参考资料,人们接受的解决方案是“我将代码更改为不使用自动属性”,这对我来说真的不能接受,因为我要更改 100 个对象(有 1000 个其中的属性)。此外,当我上周运行它时,同样的代码运行良好,并且似乎不会影响所有序列化的 DTO,只会影响一些。
更令人沮丧的是,它似乎有点断断续续。有时今天早上,没有抛出异常......!
问题;
- 为什么在未更改的代码和未更改的框架源中突然出现此问题?
- 如何在不修改所有 DTO 以使用完全实现的属性的情况下解决此问题?
更新:经过一天左右的正常工作后,这个问题再次出现 - 我没有理由找到它为什么会工作/不工作/再次工作,但我们到了。
我已经进一步追踪问题与我在 ServiceContracts 上使用ServiceKnownType
属性的一些代码相关,该属性用于定义序列化的已知类型。似乎虽然报告错误的类型甚至不是我当时正在进行的服务调用的一部分,但此错误发生在作为此已知类型“发布”行为的一部分的类型上。
当我使用一些代理创建代码来应用一些服务行为时,就会出现问题;
我无法调试ApplyClientBehavior
代码,因为它是System.ServiceModel
(或者我可以吗?)的一部分,但该方法中的某些内容试图验证我使用我的ServiceKnownType
属性发布的所有类型,并使用 this 打破其中一些XmlException
。我不知道为什么某些类型会失败 - 并且仅针对它们的某些属性。
这是针对它们报告错误的类型的示例;
异常报告了一个错误Id
-><Id>k_BackingField cannot start with '<'
因此,在该类中没有任何争议,也无需考虑继承。它甚至不是服务合同的一部分,只是它以前作为序列化的已知类型发布。
现在这变得非常深奥,所以我不期待答案,而只是更新问题所在。
c# - 为什么 XName.Get 会为以“{”开头的名称抛出 ArgumentException 而不是 XmlException?
我一直在 .NET 中对 XML 进行一些测试,发现很多有效的名称字符是不允许的。在几乎所有情况下,我都会在看似有效的字符上收到 XmlException。
XmlException 是从 System.Xml.dll 引发的,带有以下堆栈跟踪:
在 System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType) 在 System.Xml.Linq.XName..ctor(XNamespace ns, String localName) 在 System.Xml.Linq.XNamespace.GetName(String localName) 在 System。 Xml.Linq.XName.Get(字符串扩展名)
但是,在名称以“{”字符(十六进制值 0x7B)开头的情况下,我会从 System.Xml.Linq.dll 获得 ArgumentException,并带有以下堆栈跟踪:
在 System.Xml.Linq.XName.Get(字符串扩展名)
奇怪的是,这只适用于“{”是名称中的第一个字符时。如果它稍后出现在名称中,我会得到与所有其他“无效”字符相同的异常和堆栈跟踪。
由于我试图专门捕获这些异常来包装并抛出我自己的异常,所以我希望(我认为是合理的)它们都会抛出相同的异常。
为什么这会引发 ArgumentException 而不是 XmlException?
c# - Issue parsing XML string to xDocument
I am receiving an XML string from the controller of my web API that is constructed as shown:
This is fine and the XML is set as shown:
When I then return this as a string and try to parse it back to an xDoc as shown:
The string 'responsePayLoad' at runtime is set as shown:
This is giving me an exception at the 'newxDoc' object of:
XmlException is unhandled. Data at the root level is invalid. Line 1, position 1.
Can anyone tell me where I'm going wrong?
c# - “根级别的数据无效”
我正在编写一些代码来打开一个 XML 文件,读取它并将数据存储在一个列表中。唯一的事情是,当我运行我的代码时,我得到“根级别的 XmlException 数据无效”。我已经搜索了错误并且没有解决方案对我有用(或者我错过了一些东西)。
我的 XML(* = 审查员):
我的 C# 代码:
有谁能帮忙吗?