Open GoogleCodeExporter opened 9 years ago
This error is due to the XmlSerializer encountering the unexpected KML header
element (as it is expecting straight XML elements). I am trying to work out how
to
use XmlSerializer for serialising/deserialising XML and am having this problem.
Cheers,
Katie
Original comment by katie.an...@gmail.com
on 3 Jun 2008 at 10:56
The Serializer has been developed to Schema version 2.1 and google maps is now
outputting version 2.2 and the header of .... 2.2 is not recognised?
Original comment by sirjohnf...@gmail.com
on 24 Jun 2008 at 12:25
in kml.cs change the class declaration to look like this:
[XmlRoot(ElementName = "kml", Namespace = "http://www.opengis.net/kml/2.2")]
//--if you add the namespace, then all children get a blank namespace attrib...
// [XmlRoot(ElementName = "kml")]
public class KMLRoot
{
That got me around this issue, the other option is to strip the attributes out
of the
KML file you are deserializing altogether before loading it.
ie change
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
to
<kml>
Original comment by deathpat...@gmail.com
on 8 Jul 2009 at 6:05
Add the namespace declaration to the xmlroot attribute as mentioned by
deathpatrolband and also around ln 76 of XmlSerializer.cs change the namespace
manager declaration like so:
XmlSerializerNamespaces xmlns = new XmlSerializerNamespaces();
xmlns.Add("", "http://www.opengis.net/kml/2.2");
That will ditch the xsi and xsd namespaces.
Original comment by tinsoldi...@gmail.com
on 20 Aug 2010 at 1:11
I am trying this but cannot seem to get any results from trying the
suggestions, was wondering if this worked for everyone that tried it?
Original comment by millsybo...@googlemail.com
on 25 Sep 2012 at 8:53
Original issue reported on code.google.com by
ahosie@gmail.com
on 14 Apr 2008 at 7:15