将Web响应从JSON转换为XML

时间:2015-10-14 11:04:08

标签: xml web-services

我在asmx逻辑中创建了我在json中获取返回数据但我需要在if条件代码逻辑下面转换为xml格式

 if (providers[1] == Portal.*****.ToString())
    {
    CookieContainer cookie = new CookieContainer();
    var Session = obj1.GetRequest(cookie);
    var MmtHotelid = obj1.Login("**********", "******", ref hotelid,cookie);
    var ListGetRoomtype = obj1.GetRoomTypes(MmtHotelid, Session);
    var list1 = obj1.GetRoomAvail(MmtHotelid, fromdate, todate, ListGetRoomtype, Session);
    listgetinv.InvetorYDetails.Add(list1);
    }

1 个答案:

答案 0 :(得分:0)

var CtRateXml = new XElement(" Provider",new XAttribute(" Id",Portal。***** enter code here),来自listgetinv中的c                                                                                              选择新的XElement(" RoomType",新的XAttribute(" Name",c.RoomName),                                                                                                 来自c.cleartriprate中的od                                                                                                 选择新的XElement(" Rate",                                                                                                     新的XElement(" Date",od.Date),                                                                                                     新的XElement(" SingleRate",od.SingleSellRate),                                                                                                     新的XElement(" DoubleRate",od.DoubleSellRate)                                                                                                     )));