vylan / javaapiforkml

Automatically exported from code.google.com/p/javaapiforkml
0 stars 0 forks source link

error while parsing http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-depth.kmz #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1.parsing kmz from
http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-depth.kmz

i got this error 
javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://earth.google.com/kml/2.0", local:"kml"). Expected elements are
<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Address>,<{urn:oasis:names:tc:ciq:xsd
schema:xAL:2.0}AddressDetails>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Addres
sIdentifier>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}AddressLatitude>,<{urn:o
asis:names:tc:ciq:xsdschema:xAL:2.0}AddressLatitudeDirection>,<{urn:oasis:names:
tc:ciq:xsdschema:xAL:2.0}AddressLine>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0
}AddressLines>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}AddressLongitude>,<{ur
n:oasis:names:tc:ciq:xsdschema:xAL:2.0}AddressLongitudeDirection>,<{urn:oasis:na
mes:tc:ciq:xsdschema:xAL:2.0}AdministrativeArea>,<{urn:oasis:names:tc:ciq:xsdsch
ema:xAL:2.0}AdministrativeAreaName>,<{http://www.opengis.net/kml/2.2}Alias>,<{ht
tp://www.google.com/kml/ext/2.2}AnimatedUpdate>,<{http://www.opengis.net/kml/2.2
}BalloonStyle>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Barcode>,<{http://www.
opengis.net/kml/2.2}BasicLink>,<{http://www.opengis.net/kml/2.2}Boundary>,<{urn:
oasis:names:tc:ciq:xsdschema:xAL:2.0}BuildingName>,<{http://www.opengis.net/kml/
2.2}Camera>,<{http://www.opengis.net/kml/2.2}Change>,<{urn:oasis:names:tc:ciq:xs
dschema:xAL:2.0}Country>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}CountryName>
,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}CountryNameCode>,<{http://www.opengi
s.net/kml/2.2}Create>,<{http://www.opengis.net/kml/2.2}Data>,<{http://www.opengi
s.net/kml/2.2}Delete>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Department>,<{u
rn:oasis:names:tc:ciq:xsdschema:xAL:2.0}DepartmentName>,<{urn:oasis:names:tc:ciq
:xsdschema:xAL:2.0}DependentLocality>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0
}DependentLocalityName>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}DependentLoca
lityNumber>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}DependentThoroughfare>,<{
http://www.opengis.net/kml/2.2}Document>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:
2.0}EndorsementLineCode>,<{http://www.opengis.net/kml/2.2}ExtendedData>,<{urn:oa
sis:names:tc:ciq:xsdschema:xAL:2.0}Firm>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:
2.0}FirmName>,<{http://www.google.com/kml/ext/2.2}FlyTo>,<{http://www.opengis.ne
t/kml/2.2}Folder>,<{http://www.opengis.net/kml/2.2}GroundOverlay>,<{http://www.o
pengis.net/kml/2.2}Icon>,<{http://www.opengis.net/kml/2.2}IconStyle>,<{http://ww
w.opengis.net/kml/2.2}ImagePyramid>,<{http://www.opengis.net/kml/2.2}ItemIcon>,<
{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}KeyLineCode>,<{http://www.opengis.net/
kml/2.2}LabelStyle>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}LargeMailUser>,<{
urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}LargeMailUserIdentifier>,<{urn:oasis:na
mes:tc:ciq:xsdschema:xAL:2.0}LargeMailUserName>,<{http://www.opengis.net/kml/2.2
}LatLonAltBox>,<{http://www.opengis.net/kml/2.2}LatLonBox>,<{http://www.google.c
om/kml/ext/2.2}LatLonQuad>,<{http://www.opengis.net/kml/2.2}LineString>,<{http:/
/www.opengis.net/kml/2.2}LineStyle>,<{http://www.opengis.net/kml/2.2}LinearRing>
,<{http://www.opengis.net/kml/2.2}Link>,<{http://www.opengis.net/kml/2.2}ListSty
le>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Locality>,<{urn:oasis:names:tc:ci
q:xsdschema:xAL:2.0}LocalityName>,<{http://www.opengis.net/kml/2.2}Location>,<{h
ttp://www.opengis.net/kml/2.2}Lod>,<{http://www.opengis.net/kml/2.2}LookAt>,<{ur
n:oasis:names:tc:ciq:xsdschema:xAL:2.0}MailStop>,<{urn:oasis:names:tc:ciq:xsdsch
ema:xAL:2.0}MailStopName>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}MailStopNum
ber>,<{http://www.opengis.net/kml/2.2}Metadata>,<{http://www.opengis.net/kml/2.2
}Model>,<{http://www.opengis.net/kml/2.2}MultiGeometry>,<{http://www.opengis.net
/kml/2.2}NetworkLink>,<{http://www.opengis.net/kml/2.2}NetworkLinkControl>,<{htt
p://www.opengis.net/kml/2.2}Orientation>,<{http://www.opengis.net/kml/2.2}Pair>,
<{http://www.opengis.net/kml/2.2}PhotoOverlay>,<{http://www.opengis.net/kml/2.2}
Placemark>,<{http://www.google.com/kml/ext/2.2}Playlist>,<{http://www.opengis.ne
t/kml/2.2}Point>,<{http://www.opengis.net/kml/2.2}PolyStyle>,<{http://www.opengi
s.net/kml/2.2}Polygon>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostBox>,<{urn
:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostBoxNumber>,<{urn:oasis:names:tc:ciq:xs
dschema:xAL:2.0}PostBoxNumberExtension>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2
.0}PostBoxNumberPrefix>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostBoxNumber
Suffix>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostOffice>,<{urn:oasis:names
:tc:ciq:xsdschema:xAL:2.0}PostOfficeName>,<{urn:oasis:names:tc:ciq:xsdschema:xAL
:2.0}PostOfficeNumber>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostTown>,<{ur
n:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostTownName>,<{urn:oasis:names:tc:ciq:xs
dschema:xAL:2.0}PostTownSuffix>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Posta
lCode>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostalCodeNumber>,<{urn:oasis:
names:tc:ciq:xsdschema:xAL:2.0}PostalCodeNumberExtension>,<{urn:oasis:names:tc:c
iq:xsdschema:xAL:2.0}PostalRoute>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Pos
talRouteName>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostalRouteNumber>,<{ur
n:oasis:names:tc:ciq:xsdschema:xAL:2.0}PostalServiceElements>,<{urn:oasis:names:
tc:ciq:xsdschema:xAL:2.0}Premise>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Pre
miseLocation>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PremiseName>,<{urn:oasi
s:names:tc:ciq:xsdschema:xAL:2.0}PremiseNumber>,<{urn:oasis:names:tc:ciq:xsdsche
ma:xAL:2.0}PremiseNumberPrefix>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Premi
seNumberRange>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PremiseNumberRangeFrom
>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}PremiseNumberRangeTo>,<{urn:oasis:n
ames:tc:ciq:xsdschema:xAL:2.0}PremiseNumberSuffix>,<{http://www.opengis.net/kml/
2.2}Region>,<{http://www.opengis.net/kml/2.2}ResourceMap>,<{http://www.opengis.n
et/kml/2.2}Scale>,<{http://www.opengis.net/kml/2.2}Schema>,<{http://www.opengis.
net/kml/2.2}SchemaData>,<{http://www.opengis.net/kml/2.2}ScreenOverlay>,<{http:/
/www.opengis.net/kml/2.2}SimpleData>,<{http://www.opengis.net/kml/2.2}SimpleFiel
d>,<{http://www.opengis.net/kml/2.2}Snippet>,<{urn:oasis:names:tc:ciq:xsdschema:
xAL:2.0}SortingCode>,<{http://www.google.com/kml/ext/2.2}SoundCue>,<{http://www.
opengis.net/kml/2.2}Style>,<{http://www.opengis.net/kml/2.2}StyleMap>,<{urn:oasi
s:names:tc:ciq:xsdschema:xAL:2.0}SubAdministrativeArea>,<{urn:oasis:names:tc:ciq
:xsdschema:xAL:2.0}SubAdministrativeAreaName>,<{urn:oasis:names:tc:ciq:xsdschema
:xAL:2.0}SubPremise>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}SubPremiseLocati
on>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}SubPremiseName>,<{urn:oasis:names
:tc:ciq:xsdschema:xAL:2.0}SubPremiseNumber>,<{urn:oasis:names:tc:ciq:xsdschema:x
AL:2.0}SubPremiseNumberPrefix>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}SubPre
miseNumberSuffix>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}SupplementaryPostal
ServiceData>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Thoroughfare>,<{urn:oasi
s:names:tc:ciq:xsdschema:xAL:2.0}ThoroughfareLeading>,<{urn:oasis:names:tc:ciq:x
sdschema:xAL:2.0}ThoroughfareName>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Th
oroughfareNumber>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}ThoroughfareNumberF
rom>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}ThoroughfareNumberPrefix>,<{urn:
oasis:names:tc:ciq:xsdschema:xAL:2.0}ThoroughfareNumberRange>,<{urn:oasis:names:
tc:ciq:xsdschema:xAL:2.0}ThoroughfareNumberSuffix>,<{urn:oasis:names:tc:ciq:xsds
chema:xAL:2.0}ThoroughfareNumberTo>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}T
horoughfarePostDirection>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}Thoroughfar
ePreDirection>,<{urn:oasis:names:tc:ciq:xsdschema:xAL:2.0}ThoroughfareTrailing>,
<{http://www.opengis.net/kml/2.2}TimeSpan>,<{http://www.opengis.net/kml/2.2}Time
Stamp>,<{http://www.google.com/kml/ext/2.2}Tour>,<{http://www.google.com/kml/ext
/2.2}TourControl>,<{http://www.opengis.net/kml/2.2}Update>,<{http://www.opengis.
net/kml/2.2}Vec2>,<{http://www.opengis.net/kml/2.2}ViewVolume>,<{http://www.goog
le.com/kml/ext/2.2}Wait>,<{http://www.w3.org/2005/Atom}author>,<{http://www.open
gis.net/kml/2.2}kml>,<{http://www.w3.org/2005/Atom}link>
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unmars
hallingContext.java:642)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loa
der.java:116)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.
childElement(UnmarshallingContext.java:1049)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unma
rshallingContext.java:478)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(Unmar
shallingContext.java:459)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.
java:148)
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Abstra
ctSAXParser.java:501)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElemen
t(XMLNSDocumentScannerImpl.java:400)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver
.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentC
ontentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next
(XMLDocumentScannerImpl.java:921)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentS
cannerImpl.java:648)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocum
entScannerImpl.java:140)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocum
ent(XMLDocumentFragmentScannerImpl.java:510)
    at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configu
ration.java:807)
    at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configu
ration.java:737)
    at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXPa
rser.java:1205)
    at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXPar
serImpl.java:522)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unmarshalle
rImpl.java:211)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unmarshaller
Impl.java:184)
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerIm
pl.java:137)
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerIm
pl.java:184)
    at de.micromata.opengis.kml.v_2_2_0.Kml.unmarshal(Kml.java:850)
    at de.micromata.opengis.kml.v_2_2_0.Kml.unmarshalFromKmz(Kml.java:892)
    at worldwind.kml.KMLLayer.load(KMLLayer.java:503)
    at com.cgii.globe.ui.views.ui.MyPlacesPanel.LoadKML(MyPlacesPanel.java:234)
    ...

Original issue reported on code.google.com by isapoetra on 23 Sep 2009 at 5:06

GoogleCodeExporter commented 9 years ago

Original comment by bachmann...@gmail.com on 7 Oct 2009 at 7:35

GoogleCodeExporter commented 9 years ago
Hello.
I have the same problem with "http://earth.google.com/kml/2.2" uri.
Could U tell me, when it will be fixed?

Original comment by Nicolas....@gmail.com on 15 Oct 2009 at 9:43

GoogleCodeExporter commented 9 years ago
I'm aware of the problem. Unfortunately I hadn't any free time yet, but I will 
fix
it, as soon as possible.

Original comment by bachmann...@gmail.com on 15 Oct 2009 at 11:17

GoogleCodeExporter commented 9 years ago

Original comment by bachmann...@gmail.com on 23 Nov 2009 at 7:33

GoogleCodeExporter commented 9 years ago

Original comment by bachmann...@gmail.com on 30 Nov 2009 at 10:19

GoogleCodeExporter commented 9 years ago
Is this really fixed? I download source code from svn repository, build JAK 
with "mvn install" command and 
included produced .jar file in my test project. But it still throws exception 
on namespace <kml 
xmlns="http://earth.google.com/kml/2.2"> or <kml 
xmlns="http://earth.google.com/kml/2.0"> in kml file.

Was this really fixed? Can somebody confirm this, please?

Original comment by simon.iv...@gmail.com on 8 May 2010 at 11:14

GoogleCodeExporter commented 9 years ago
I keep getting the same error. Can we specify any configuration for the library 
with which this error does not occur, or at least it ignores it?

Original comment by jorge.al...@gmail.com on 14 Jul 2010 at 1:38

GoogleCodeExporter commented 9 years ago
This error is still there. I keep getting this error while parsing files with 
this:

<kml xmlns="http://earth.google.com/kml/2.2">

can you reopen the issue and refix this?

Thanks

Original comment by buj...@gmail.com on 19 Aug 2010 at 12:06

GoogleCodeExporter commented 9 years ago
this api is shit. Cant even read google earth kml files

Original comment by davidall...@gmail.com on 16 Nov 2010 at 12:57

GoogleCodeExporter commented 9 years ago
issue is still here in 2012, please fix!

Original comment by clankil...@gmail.com on 8 Feb 2012 at 5:03

GoogleCodeExporter commented 9 years ago
This same issue with files given here: http://www.gadm.org/

Original comment by vanek.lu...@gmail.com on 17 Apr 2012 at 7:39

GoogleCodeExporter commented 9 years ago
The problem is not with JavaAPIforKML, but rather with the KML file itself.
The CORRECT namespace is "http://www.opengis.net/kml/2.2"

Here's a really bad perl script to repair a KML file(s).  Just add the files as 
arguments to the script (e.g. fixxmlns *.kml)

#!/usr/bin/perl

for (@ARGV) {

    open (FH,"<$_");
    open (NFH,">$_.x");

    $look = 1;
    while ($r = <FH>) {
        if ($look && $r =~ /earth.google.com/) {
            $r = qq{<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2">\n};
            $look = 0;
            }
        print NFH $r;
    }
    close (NFH);
    close (FH);
    rename("$_", "$_.orig");
    rename("$_.x", "$_");
}

Original comment by drew.gon...@gmail.com on 9 Jan 2013 at 6:34

GoogleCodeExporter commented 9 years ago
This might be worth a shot as well ... sorry no time to test right now.

       Kml kml = null;
        try {
            kml = Kml.unmarshal(path);
        } catch (RuntimeException ex) {
            kml = Kml.unmarshal(new File(path), false);
        }

Original comment by drew.gon...@gmail.com on 9 Jan 2013 at 6:52

GoogleCodeExporter commented 9 years ago
@drew: This doesn't help, because the default value for validate is false 
anyway.

Original comment by klemens....@gmail.com on 3 Jan 2014 at 5:20