I have generated a C# model from XML code given below along with c# model, when trying to cast that I am facing issues like
InvalidOperationException: The specified type was not recognized: name='MetadataNumberValue',at <TypedValue xmlns='...
I want to ignore the XML attributes that are in TypedValue tag in the c# model.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Metadata xmlns="http://www.samplevm.com/democloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.samplevm.com/schema/ovf" xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1" xmlns:vmext="http://www.samplevm.com/democloud/extension/v1.5" xmlns:ns9="http://www.samplevm.com/democloud/versions" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+xml">
<Link rel="up" href="https://mysiter.com/api/admin/vdc/1234" type="application/vnd.samplevm.admin.vdc+xml"/>
<Link rel="up" href="https://mysiter.com/api/admin/vdc/1234" type="application/vnd.samplevm.admin.vdc+json"/>
<Link rel="add" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+xml"/>
<Link rel="add" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+json"/>
<MetadataEntry href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.Reservation" type="application/vnd.samplevm.democloud.metadata.value+xml">
<Link rel="up" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+xml"/>
<Link rel="up" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+json"/>
<Link rel="edit" href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.Reservation" type="application/vnd.samplevm.democloud.metadata.value+xml"/>
<Link rel="edit" href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.Reservation" type="application/vnd.samplevm.democloud.metadata.value+json"/>
<Link rel="remove" href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.Reservation"/>
<Key>Reservation1</Key>
<**TypedValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="MetadataNumberValue">**
<Value>100</Value>
</TypedValue>
</MetadataEntry>
<MetadataEntry href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.AllocationType" type="application/vnd.samplevm.democloud.metadata.value+xml">
<Link rel="up" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+xml"/>
<Link rel="up" href="https://mysiter.com/api/admin/vdc/1234/metadata" type="application/vnd.samplevm.democloud.metadata+json"/>
<Link rel="edit" href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.AllocationType" type="application/vnd.samplevm.democloud.metadata.value+xml"/>
<Link rel="edit" href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.AllocationType" type="application/vnd.samplevm.democloud.metadata.value+json"/>
<Link rel="remove" href="https://mysiter.com/api/admin/vdc/1234/metadata/CCLCloud.AllocationType"/>
<Key>AllocationType1</Key>
<TypedValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="MetadataStringValue">
<Value>OnDemand100</Value>
</TypedValue>
</MetadataEntry>
</Metadata>```
// NOTE: Generated code may require at least .NET Framework 4.5 or .NET Core/Standard 2.0.
/// <remarks/>
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.samplevm.com/democloud/v1.5")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.samplevm.com/democloud/v1.5", IsNullable = false)]
public partial class Metadata
{
private MetadataLink[] linkField;
private MetadataMetadataEntry[] metadataEntryField;
private string hrefField;
private string typeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Link")]
public MetadataLink[] Link
{
get
{
return this.linkField;
}
set
{
this.linkField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("MetadataEntry")]
public MetadataMetadataEntry[] MetadataEntry
{
get
{
return this.metadataEntryField;
}
set
{
this.metadataEntryField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string href
{
get
{
return this.hrefField;
}
set
{
this.hrefField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string type
{
get
{
return this.typeField;
}
set
{
this.typeField = value;
}
}
}
/// <remarks/>
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.samplevm.com/democloud/v1.5")]
public partial class MetadataLink
{
private string relField;
private string hrefField;
private string typeField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string rel
{
get
{
return this.relField;
}
set
{
this.relField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string href
{
get
{
return this.hrefField;
}
set
{
this.hrefField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string type
{
get
{
return this.typeField;
}
set
{
this.typeField = value;
}
}
}
/// <remarks/>
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.samplevm.com/democloud/v1.5")]
public partial class MetadataMetadataEntry
{
private MetadataMetadataEntryLink[] linkField;
private string keyField;
private MetadataMetadataEntryTypedValue typedValueField;
private string hrefField;
private string typeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Link")]
public MetadataMetadataEntryLink[] Link
{
get
{
return this.linkField;
}
set
{
this.linkField = value;
}
}
/// <remarks/>
public string Key
{
get
{
return this.keyField;
}
set
{
this.keyField = value;
}
}
/// <remarks/>
public MetadataMetadataEntryTypedValue TypedValue
{
get
{
return this.typedValueField;
}
set
{
this.typedValueField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string href
{
get
{
return this.hrefField;
}
set
{
this.hrefField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string type
{
get
{
return this.typeField;
}
set
{
this.typeField = value;
}
}
}
/// <remarks/>
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.samplevm.com/democloud/v1.5")]
public partial class MetadataMetadataEntryLink
{
private string relField;
private string hrefField;
private string typeField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string rel
{
get
{
return this.relField;
}
set
{
this.relField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string href
{
get
{
return this.hrefField;
}
set
{
this.hrefField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string type
{
get
{
return this.typeField;
}
set
{
this.typeField = value;
}
}
}
/// <remarks/>
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.samplevm.com/democloud/v1.5")]
public partial class MetadataMetadataEntryTypedValue
{
private string valueField;
/// <remarks/>
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}