I'm using XML-RPC.NET library to map responses from Wordpress' APIs. However Im getting the following issue regarding the mapping of an article image.
If the response contains an image it will return a struct like so
<member>
<name>post_thumbnail</name>
<value>
<struct>
...
</struct>
</value>
</member>
Which I can then map to my struct in c#
public struct PostThumbnail
{
//Thumbnail properties
}
If there is no image then I get an empty array in the response instead of a struct
<member>
<name>post_thumbnail</name>
<value>
<array>
<data>
</data>
</array>
</value>
</member>
This doesnt map and throws the following error
CookComputing.XmlRpc.XmlRpcTypeMismatchException response contains array value where struct expected [response : array mapped to type Post[] : element 0 : struct mapped to type Post : member post_thumbnail mapped to type PostThumbnail]
Is there a way I can ignore this mapping if the wrong type has been returned?