Serialisering af XML i C#
HejsaNedenstående xml-streng, som jeg ønskera at serialisere:
Jeg ønsker at få fat på:
- merchantCode="DANFREUR"
- orderCode="2-d4186484c743"
- reference id="3054234213"
- reference = https://payments-test.worldpay.com/app
<?xml version="1.0" encoding="UTF-8"?>
<paymentService version="1.4" merchantCode="DANFREUR">
<reply>
<orderStatus orderCode="2c00286484c743">
<reference id="3054233">
https://payments-est.worldpay.com/a47299817475202gGF_yXIZpho134rLgPcK2w
</reference>
</orderStatus>
</reply>
</paymentService>
Jeg har prøvet mange muligheder, men her er en mulighed, som kun giver MerchantCode.
kan nogle hjælpe mig? Guide mig?
[Serializable()]
[XmlRoot("paymentService")]
public class paymentService
{
[XmlAttribute("merchantCode")]
public string merchantCode;
[XmlElement("reply")]
public orderStatus references;
}
public class orderStatus
{
public string reference;
}
#region Attributes
// Attribute for
// PaymentService/reply/orderstatus/reference
public class Reference_ID
{
[XmlAttribute]
public int id { get; set; }
}
// Attribute for
// PaymentService/reply/orderStatus
public class OrderStatus_OrderCode
{
[XmlAttribute]
public string orderCode { get; set; }
}