Greetings,
I've got a XML file that I deserialize into an object using
XmlSerializer:
<?xml version="1.0" encoding="utf-8"?>
<factory
xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<widgets>
<widget xsi:type="WidgetA">
</widget>
<widget xsi:type="WidgetB">
</widget>
</widgets>
</factory>
Everything is just fine when I provide XmlSerializer with extra types
for WidgetA and WidgetB classes. The question is how to handle a
situation when, for example, the app doesn't know anything about
WidgetB class (a plug-in isn't installed and so on). Right now
InvalidOperationException occures but ideally I would like <widget> tag
for WidgetB to be skipped with no interruption for deserialization
process.
Any advices, approaches?
Regards,
Yuriy