N
NiceStepUp
Guest
I've read and tried many threads - this answer, this and this answer. However, they are not applicable to me as I have really not usual xml:
var xmlString = @"<?xml version=""1.0"" encoding=""windows-1251""?>
<GetReply>
<InformOne>87</InformOne>
<InfoReply>
<![CDATA[<?xml version='1.0' encoding='UTF-8'?>
<S:Container xmlns:S=""http://schemas.xmlsoap.org/soap/envelope/"">
<S:Body>
<ns2:getReference31IPOResponse xmlns:ns2 = ""http://service.one.com/"" >
<return>
<reference31_1IPO xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:nil=""true""/>
<reference31_2IPO xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:nil=""true""/>
<amount>0</amount>
<codeTypeObject>0</codeTypeObject>
<returnCode>4</returnCode>
<errorCode>0</errorCode>
<errorMessage>Something was wrong</errorMessage>
<title>Foo Data</title>
</return>
</ns2:getReference31IPOResponse>
</S:Body>
</S:Container>]]>
</InfoReply>
</GetReply>";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
var errorMessage = xmlDoc.SelectSingleNode("/GetReply/InformOne/InfoReply/CDATA/S:Container/S:Body/ns2:getReference31IPOResponse/return/errorMessage");
However, I see the following error:
'Expression must evaluate to a node-set.'
In addition, I even tried to get InfoReply, however the error is the same:
var errorMessage = xmlDoc.SelectSingleNode("/GetReply/InformOne/InfoReply/");
What I want is to read text in errorMessage node?
Could you tell me please, what I am doing wrong? I need to take value by XmlDocument class. Any help would be greatly appreciated.
Continue reading...
var xmlString = @"<?xml version=""1.0"" encoding=""windows-1251""?>
<GetReply>
<InformOne>87</InformOne>
<InfoReply>
<![CDATA[<?xml version='1.0' encoding='UTF-8'?>
<S:Container xmlns:S=""http://schemas.xmlsoap.org/soap/envelope/"">
<S:Body>
<ns2:getReference31IPOResponse xmlns:ns2 = ""http://service.one.com/"" >
<return>
<reference31_1IPO xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:nil=""true""/>
<reference31_2IPO xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:nil=""true""/>
<amount>0</amount>
<codeTypeObject>0</codeTypeObject>
<returnCode>4</returnCode>
<errorCode>0</errorCode>
<errorMessage>Something was wrong</errorMessage>
<title>Foo Data</title>
</return>
</ns2:getReference31IPOResponse>
</S:Body>
</S:Container>]]>
</InfoReply>
</GetReply>";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
var errorMessage = xmlDoc.SelectSingleNode("/GetReply/InformOne/InfoReply/CDATA/S:Container/S:Body/ns2:getReference31IPOResponse/return/errorMessage");
However, I see the following error:
'Expression must evaluate to a node-set.'
In addition, I even tried to get InfoReply, however the error is the same:
var errorMessage = xmlDoc.SelectSingleNode("/GetReply/InformOne/InfoReply/");
What I want is to read text in errorMessage node?
Could you tell me please, what I am doing wrong? I need to take value by XmlDocument class. Any help would be greatly appreciated.
Continue reading...