1
Vote

Ending </kml> tag not written to file.

description

I am creating a KML file, and it seems to load into Google Earth fine, but I noticed that the file is missing the </kml> tag. When I export the same back out of Google Earth, it writes it correctly.

file attachments

comments

samcragg wrote Feb 16 at 9:01 AM

How are you generating the KML?

Since the line count is different I'm guessing the start <kml> tag is also missing and that you might be saving just a Document element without wrapping it in an SharpKml.Dom.Kml element (you can set it's Feature property to the Document element you're generating).

Does that help solve the issue?

shiften wrote Feb 16 at 3:02 PM

Ok. That is the case. I didn't realize that KmlFile needed to accept a Kml element instead of the document. If this is always the case, shouldn't KmlFile.Create() limit on that type instead of accepting any Element?

samcragg wrote Feb 16 at 3:46 PM

That's a good suggestion, looking at the spec (including the 2.3) and it is listed as the root element so I guess there's no reason to allow others to be passed in. This will be a breaking change, so won't happen for a while but when the 2.3 changes are released that will be a breaking change so can be included then.

Thanks for the suggestion