Sam, thanks for your quick answer. You're faster than a normal helpdesk :-)
The sample code from the
TourPrimitive you mentioned is indeed not working. They miss what I mentioned in my first post, namely the second attribute of the <kml> element, which comes on the second line in this snippet:
Another thing they're missing is the "id" attribute for the style. Their declaration should look like this:
If you add these two modifications their example will work. In fact I remember I encountered the same example in their tutorials and it worked at that time, so I looked back and I found it
here, where they teach about tour updates.
The code given there contains the two corrections I mentioned and works properly. They just forgot to also update the example in the reference documentation.
Coming to your C# code, I compiled/ran it and the output suffers more or less from the same problem as my outputs.
First of all, there are the two problems mentioned above.
Second, all Google extension elements miss the "gx:" prefix. For example, your program outputs <Tour> instead of <gx:Tour>
Third, your code adds an xmlns attribute to the <Tour> element, making it <Tour xmlns="http://www.google.com/kml/ext/2.2"> . The tour will work only after deleting the xmlns attribute.
There is also a fourth problem I encountered with SharpKML, but not in this code. Namely, the <gx:flyToMode> element is written as <gx:FlyToMode>, which is incorrect, as KML is case sensitive. The tour won't work with capital F, unfortunately.
My questions remain therefore the same:
1) How to add the xmlns:gx attribute to the <kml> element?
2) How to add the "gx:" prefixes to the non-standard Google extensions?
3) This is new, but it's still a problem: How to avoid adding the xmlns attribute to the <gx:Tour> element?
4) I put this here again, for the record: How can I correct the <gx:FlyToMode> element to start with lower case: <gx:flyToMode>?