Skip to content

How to read extended KML if extension contains List #44

@tothalexlaszlo

Description

@tothalexlaszlo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions