Извините за простоты, но это один ускользает меня Хир является запрос XML мыло: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>
и код С #
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) {}
??? hou я могу получить данные «CotisationMensuelle» ??? Я получаю нулевые данные, hou ik может решить эту проблему?
«CotisationMensuelle» находится внутри GarantieOutput ... Так что-то вроде : Root -> TarifResult -> BusinessData -> Предложение -> Garantie -> GarantieOutput -> CotisationMensualle – Crasher
Вы можете использовать XPath 2: http://www.w3schools.com/xpath/ ... и написать что-то вроде: XmlDocument xmlDoc = новый Xm lDocument(); Загрузить ... xmlDoc.SelectSingleNode ("//CotisationMensuelle").Value; или что-то вроде этого =) – Crasher