This project has moved. For the latest updates, please go here.

Error loading KML File

Mar 18, 2013 at 1:47 PM
I am getting a 4004 error "System.xml.xmlexception: 'xsi' is an undeclared namespace. line 3, position 26.

I am using the silver light library.
Private Sub Load_KML(ByVal data As FileStream)
    Dim file As KmlFile

    Dim test As New SharpKml.Base.Parser()


    AddHandler test.ElementAdded, AddressOf KMLParser

    test.Parse(data) ' Errors here
I also tried
   file = KmlFile.Load(data)  ' Errors here
Mar 18, 2013 at 2:38 PM
The error is coming from this: Removing the XSI from the document tag fixes the error.. how to fix? <?xml version="1.0" encoding="UTF-8"?> <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"> <Document id="MMS_SCOPE" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd http://www.google.com/kml/ext/2.2 http://code.google.com/apis/kml/schema/kml22gx.xsd"> <name>MMS_SCOPE</name> <Snippet maxLines="0"></Snippet> <Style id="LineStyle00"> <LabelStyle> <color>00000000</color> The rest is truncated.
Mar 21, 2013 at 1:06 PM
Another case when it does nothing.... <?xml version="1.0" encoding="utf-8"?> <kml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://earth.google.com/kml/2.1"> <Document> If i change it to <?xml version="1.0" encoding="UTF-8"?> <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"> <Document> it works fine.