vector<pair<int, string>> attribute;
时间: 2023-12-17 10:05:44 浏览: 52
This is a declaration of a vector container named "attribute" that can store pairs of integer and string data types. Each element in the vector will be a pair consisting of an integer value and a corresponding string value.
相关问题
application/x-www-form-urlencoded传参,<OTA_CancelRQ CancelType="Commit" EchoToken="970893a6-ff95-4054-a6e8-e6dce2dacf87" UserName="elong" Password="J09iXbM0MeBU7cNtIGqOgg==" PrimaryLangID="en-us" TimeStamp="2007-06-29 02:21:37" Version="1.000" > <POS> <Source> <RequestorID ID="elong" Type="2" /> </Source> </POS><CancelOutOfRule Rule="true"><PayHotelAmount>0.0000</PayHotelAmount><clientUniqueId>17050039</clientUniqueId><deductHotelAmount>166.7800</deductHotelAmount><Notes>客人行程有变申请免费取消,联系供应商工号8002同意取消,双方备注为准</Notes></CancelOutOfRule> <UniqueID ID="705545245" Type="14"> <CompanyName>Elong</CompanyName> </UniqueID> <UniqueID ID="942033314699" Type="10"> <CompanyName>PartnerID</CompanyName> </UniqueID> <Reasons> <Reason>客人申请免费取消 联系供应商8823 同意免费取消双方口头备注为准 ;预付订单 ;价格:9.1/120.7000;;ResID:705545245</Reason> </Reasons> </OTA_CancelRQ>转化为.net core模型
以下是将该XML转换为.NET Core模型的代码:
```csharp
using System.Xml.Serialization;
[XmlRoot(ElementName = "OTA_CancelRQ")]
public class OTA_CancelRQ
{
[XmlAttribute(AttributeName = "CancelType")]
public string CancelType { get; set; }
[XmlAttribute(AttributeName = "EchoToken")]
public string EchoToken { get; set; }
[XmlAttribute(AttributeName = "UserName")]
public string UserName { get; set; }
[XmlAttribute(AttributeName = "Password")]
public string Password { get; set; }
[XmlAttribute(AttributeName = "PrimaryLangID")]
public string PrimaryLangID { get; set; }
[XmlAttribute(AttributeName = "TimeStamp")]
public string TimeStamp { get; set; }
[XmlAttribute(AttributeName = "Version")]
public string Version { get; set; }
[XmlElement(ElementName = "POS")]
public POS POS { get; set; }
[XmlElement(ElementName = "CancelOutOfRule")]
public CancelOutOfRule CancelOutOfRule { get; set; }
[XmlElement(ElementName = "UniqueID")]
public List<UniqueID> UniqueID { get; set; }
[XmlElement(ElementName = "Reasons")]
public Reasons Reasons { get; set; }
}
public class POS
{
[XmlElement(ElementName = "Source")]
public Source Source { get; set; }
}
public class Source
{
[XmlElement(ElementName = "RequestorID")]
public RequestorID RequestorID { get; set; }
}
public class RequestorID
{
[XmlAttribute(AttributeName = "ID")]
public string ID { get; set; }
[XmlAttribute(AttributeName = "Type")]
public string Type { get; set; }
}
public class CancelOutOfRule
{
[XmlAttribute(AttributeName = "Rule")]
public bool Rule { get; set; }
[XmlElement(ElementName = "PayHotelAmount")]
public string PayHotelAmount { get; set; }
[XmlElement(ElementName = "clientUniqueId")]
public string ClientUniqueId { get; set; }
[XmlElement(ElementName = "deductHotelAmount")]
public string DeductHotelAmount { get; set; }
[XmlElement(ElementName = "Notes")]
public string Notes { get; set; }
}
public class UniqueID
{
[XmlAttribute(AttributeName = "ID")]
public string ID { get; set; }
[XmlAttribute(AttributeName = "Type")]
public string Type { get; set; }
[XmlElement(ElementName = "CompanyName")]
public string CompanyName { get; set; }
}
public class Reasons
{
[XmlElement(ElementName = "Reason")]
public string Reason { get; set; }
}
```
<OTA_InventoryCheckRQ EchoToken=\"487ef6b0-3526-45e3-81e7-0eac31754c10\" Password=\"abc888888\" PrimaryLangID=\"en-us\" TimeStamp=\"2021-04-20 10:30:59\" UserName=\"guowang\" Version=\"1.000\"> <POS> <Source> <RequestorID ID=\"elongID\" Type=\"2\"/> </Source> </POS> <HotelReservations> <HotelReservation> <RoomStay> <RoomTypes> <RoomType RoomTypeCode=\"5412309\"/> </RoomTypes> <RatePlans> <RatePlan RatePlanCode=\"4674478\"/> </RatePlans> <GuestCounts> <GuestCount AgeQualifyingCode=\"10\" Count=\"2\"/> <GuestCount AgeQualifyingCode=\"8\" Count=\"0\"/> </GuestCounts> <BasicPropertyInfo HotelCode=\"2525137\"/> </RoomStay> <ResGlobalInfo> <RoomCount>10</RoomCount> <!-- 会员登记-开关露出 --> <MemberLevel>V1</MemberLevel> <TimeSpan End=\"2021-04-30\" Start=\"2021-04-29\"/> </ResGlobalInfo> </HotelReservation> </HotelReservations> </OTA_InventoryCheckRQ>转换为.net core模型
以下是将该XML转换为.net core模型的代码:
```
using System.Xml.Serialization;
[XmlRoot(ElementName = "OTA_InventoryCheckRQ")]
public class InventoryCheckRequest
{
[XmlAttribute(AttributeName = "EchoToken")]
public string EchoToken { get; set; }
[XmlAttribute(AttributeName = "Password")]
public string Password { get; set; }
[XmlAttribute(AttributeName = "PrimaryLangID")]
public string PrimaryLangID { get; set; }
[XmlAttribute(AttributeName = "TimeStamp")]
public string TimeStamp { get; set; }
[XmlAttribute(AttributeName = "UserName")]
public string UserName { get; set; }
[XmlAttribute(AttributeName = "Version")]
public string Version { get; set; }
public POS POS { get; set; }
public HotelReservations HotelReservations { get; set; }
}
public class POS
{
public Source Source { get; set; }
}
public class Source
{
public RequestorID RequestorID { get; set; }
}
public class RequestorID
{
[XmlAttribute(AttributeName = "ID")]
public string ID { get; set; }
[XmlAttribute(AttributeName = "Type")]
public string Type { get; set; }
}
public class HotelReservations
{
public HotelReservation HotelReservation { get; set; }
}
public class HotelReservation
{
public RoomStay RoomStay { get; set; }
public ResGlobalInfo ResGlobalInfo { get; set; }
}
public class RoomStay
{
public RoomTypes RoomTypes { get; set; }
public RatePlans RatePlans { get; set; }
public GuestCounts GuestCounts { get; set; }
public BasicPropertyInfo BasicPropertyInfo { get; set; }
}
public class RoomTypes
{
public RoomType RoomType { get; set; }
}
public class RoomType
{
[XmlAttribute(AttributeName = "RoomTypeCode")]
public string RoomTypeCode { get; set; }
}
public class RatePlans
{
public RatePlan RatePlan { get; set; }
}
public class RatePlan
{
[XmlAttribute(AttributeName = "RatePlanCode")]
public string RatePlanCode { get; set; }
}
public class GuestCounts
{
public List<GuestCount> GuestCount { get; set; }
}
public class GuestCount
{
[XmlAttribute(AttributeName = "AgeQualifyingCode")]
public string AgeQualifyingCode { get; set; }
[XmlAttribute(AttributeName = "Count")]
public string Count { get; set; }
}
public class BasicPropertyInfo
{
[XmlAttribute(AttributeName = "HotelCode")]
public string HotelCode { get; set; }
}
public class ResGlobalInfo
{
public string RoomCount { get; set; }
public string MemberLevel { get; set; }
public TimeSpan TimeSpan { get; set; }
}
public class TimeSpan
{
[XmlAttribute(AttributeName = "End")]
public string End { get; set; }
[XmlAttribute(AttributeName = "Start")]
public string Start { get; set; }
}
```
阅读全文