很抱歉的简单,但是这一次是躲避箱,票数是XML SOAP请求:xml根元素的缺失
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TarifResponse xmlns="http://www.april-technologies.com">
<TarifResult>
<Status>
<Summary>
<ResponseTechnicalLabel />
<ResponseTechnicalData>OK</ResponseTechnicalData>
</Summary>
</Status>
<BusinessData>
<IdentifiantProjet>1296483</IdentifiantProjet>
<Proposition>
<PropositionOutput>
<Ordre>1</Ordre>
<Produit>SanteEssentiel</Produit>
<Garantie>
<GarantieOutput>
<Libelle>Niveau 1</Libelle>
<CotisationMensuelle>5998</CotisationMensuelle>
</GarantieOutput>
</Garantie>
<ValiditeTarif>
<DateDebut>01/01/2014</DateDebut>
<DateFin>31/12/2014</DateFin>
</ValiditeTarif>
<OptionProduit />
</PropositionOutput>
</Proposition>
</BusinessData>
</TarifResult>
</TarifResponse>
</soap:Body>
</soap:Envelope>
和码C#是
XDocument docxx = XDocument.Parse(Session["xmlrs" + z + ""].ToString());
//This now holds the set of all elements named field
try
{
XNamespace foobar = "http://www.april-technologies.com";
var urlList = docxx.Descendants(foobar + "CotisationMensuelle")
.Select(x => (string)x)
.ToList();
Console.WriteLine(urlList);
rpMyRepeater1.DataSource = urlList;
rpMyRepeater1.DataBind();
}
catch(Exception ex) {}
???侯我可以得到数据“CotisationMensuelle”?我得到空数据,hou ik可以解决这个问题吗?
“CotisationMensuelle”里面GarantieOutput ......因此,像:根 - > TarifResult - > BusinessData - >命题 - > Garantie - > GarantieOutput - > CotisationMensualle – Crasher
您可以使用XPath 2:http://www.w3schools.com/xpath/ ...并编写如下所示的内容:XmlDocument xmlDoc =新的Xm lDocument();加载... xmlDoc.SelectSingleNode(“//CotisationMensuelle").Value;或类似的东西=) – Crasher