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模型
时间: 2023-08-14 12:26:57 浏览: 73
以下是将该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; }
}
```
阅读全文