Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml SelectSingleNode返回错误包含无效令牌_Xml_Vb.net - Fatal编程技术网

Xml SelectSingleNode返回错误包含无效令牌

Xml SelectSingleNode返回错误包含无效令牌,xml,vb.net,Xml,Vb.net,我试图获取令牌节点的值,但我无法找出我做错了什么 这是用于vb.net应用程序向URL发送XML字符串 这是XML: <?xml version="1.0" encoding="UTF-8"?> -<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas

我试图获取令牌节点的值,但我无法找出我做错了什么

这是用于vb.net应用程序向URL发送XML字符串

这是XML:

<?xml version="1.0" encoding="UTF-8"?>
-<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
-<soap:Body>
-<ProcessRequestResponse xmlns="http://itiwnet.com/WebServices/">
-<ProcessRequestResult>
-<fiAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://integration.fiapi.com" xsi:schemaLocation="http://integration.fiapi.com/fiAPI.xsd" xmlns:xenc="http://www.w3.org/2001/xmlenc#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ITI="http://www.ITIWnet.com/">
+<fiHeader Version="2.2">
-<Response TypeOfResponse="LoginRs" ResponseID="ReqID" More="false">
+<Status>
<Token>some really long stringToken>
</Response>
</fiAPI>
</ProcessRequestResult>
</ProcessRequestResponse>
</soap:Body>
</soap:Envelope>
我正在尝试获取令牌节点的值
任何帮助都将不胜感激

无效的标记是反斜杠。XPath只使用正斜杠。

Ah..我不知道这一点。我将后斜杠替换为前斜杠,但现在我得到了错误:“对象引用未设置为对象的实例。”在同一行。有什么想法吗?我不知道名称空间的问题,所以我只是去掉了所有的名称空间。可能不是“最好”的解决方案,但目前它仍然有效。任何其他想法都会很有帮助。如果您有补充问题,请将其作为新问题提出,而不是作为对答案的评论。并像描述原始问题一样仔细地描述它们。
     Dim nsmgr As New XmlNamespaceManager(xmlDoc.NameTable)
     nsmgr.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema")
     nsmgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
     nsmgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/")
     nsmgr.AddNamespace("xenc", "http://www.w3.org/2001/xmlenc#")
     nsmgr.AddNamespace("ds", "http://www.w3.org/2000/09/xmlsig#")
     nsmgr.AddNamespace("ITI", "http://www.ITIWnet.com")
     txtToken.Text = xmlDoc.SelectSingleNode               ("soap:Body\ProcessRequestResponse\ProcessRequestResult\fiAPI\Response\Token"     , nsmgr).InnerText