Oct 8, 2010 at 8:32 PM
Edited Oct 8, 2010 at 8:32 PM
Hello again. This approach is working well to a degree -- the ParseString() function is able to succssfully parse through the kml. But I am running into issues at this block during the SerializeElement() routine in Serializer.cs:
foreach (var ns in element.Namespaces.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml))
_writer.WriteAttributeString("xmlns", ns.Key, string.Empty, ns.Value);
When executing the WriteAttributeString() above, an exception is thrown: "The prefix '' cannot be redefined from 'http://www.opengis.net/kml/2.2' to 'http://earth.google.com/kml/2.2' within the same start element tag."
In the block above, ns.Key is blank, but a few lines prior, the following block is already inserting this non-prefixed namespace: "http://www.opengis.net/kml/2.2"
else if (component != null)
I believe the two namespaces are encroaching upon one another. Is the intention to preserve the old namespace, insert a new namespace, or to make both namespaces coexist in the same document? When I comment the offending foreach loop, the program
works like a charm. Any help would be much appreciated! Let me know if kmz files and code from my end would help out in this matter.
Thanks again for your help. --MattGerg