I have an xml part that looks something like
<SubscriptionProduct> <SubscriptionProductIdentifier> <SubscriptionProductIdentifierType> <SubscriptionProductIDType>01</SubscriptionProductIDType> <ID>123456</ID> <Value>AAAA</Value> </SubscriptionProductIdentifierType> <SubscriptionProductIdentifierType xsi:nil="true" /> </SubscriptionProductIdentifier> <SubscriptionProductDescription /> </SubscriptionProduct>
As you can see, SubscriptionProductIdentifierType is a collection and in this case contains only one element.
How to ignore the second empty element?
I tried adding ignore xml, however it deletes the whole collection, and I want the second element in the collection to be deleted if there is no data.
[System.Xml.Serialization.XmlIgnoreAttribute()] public SubscriptionProductIdentifierType[] SubscriptionProductIdentifier { get { return this.subscriptionProductIdentifierField; } set { this.subscriptionProductIdentifierField = value; } }
Any help would be greatly appreciated.
Regards Zal
source share