且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根级别的数据无效。第1行1。

更新时间:2023-10-24 23:18:34

如果您尝试从该URL读取XML,则需要将链接指向xml文档,而不是
If you are trying to read the XML from that URL then you will need to have the link point to an xml document and not
OK: test_397_346<br>

这是无效的XML。您可以在以下网址 [ ^ ]使用XmlTextReader而不是XmlDocument



但是,如果你是试图将 str 解释为xml然后它无效 - 尝试将&符号& 更改为&安培; amp; (删除空格 - 仅包括它们以阻止此编辑器将其更改为&)

您还需要文件的根节点,因此请尝试使用标签

例如

which is not valid XML. You can find more information on reading XML from a URL here[^] which uses XmlTextReader instead of XmlDocument

If however, you are trying to interpret str as xml then it is not valid - try changing the ampersands & to & amp ; (remove the spaces - only included them to stop this editor changing it to &)
You also need a root node for the file so try surrounding the text with tags
e.g.

String str = "<url>https://mx.fortdigital.net/http/send-message?username=test&amp;password=test&amp;to=6593365219&amp;from=FortDigital&amp;message-type=sms.automatic&amp;message=Message+Testing+Haloo</url>";



您正在使用加载将文件名作为参数的方法,因此它试图将该文本作为文件打开 - 改为使用 LoadXml


You are using the Load method that takes a filename as a parameter so it is trying to open that text as a file - use LoadXml instead.