sharpkml
sharpkml copied to clipboard
How to read extended KML if extension contains List
Assume we have the following KML extract:
<Document>
<ext:FeatureExtension>
<ext:security>
<ext:name>security xxx</ext:name>
<ext:country>ESP</ext:country>
<ext:country>ITA</ext:country>
</ext:security>
</ext:FeatureExtension>
</Document>
the models are:
[KmlElement(nameof(FeatureExtension), Constants.XmlNamespace)]
public class FeatureExtension : Element
{
[KmlElement("security", Constants.XmlNamespace)]
public Security? Security { get; set; }
}
[KmlElement("security", Constants.XmlNamespace)]
public class Security : Element
{
[KmlElement("name", Constants.XmlNamespace)]
public string Name { get; set; }
[KmlElement("country", Constants.XmlNamespace)]
public List<string> Country { get; set; }
}
// the KML extension registration
KmlFactory.RegisterExtension<Feature, FeatureExtension>();
KmlFactory.RegisterExtension<FeatureExtension, Security>();
The security tag isn't read in correctly all the country tags are missing. How should it be done? Thanks for any suggestion.