LINUX.ORG.RU

[Perl][KML] Парсинг файла

 


0

1

Приветствую, необходимо распарсить muplaces.txt из GoogleEarth. Использую Geo::KML:

#!/usr/bin/env perl

use strict;
use warnings;
use Geo::KML;
use Log::Report;

dispatcher mode => DEBUG => 'ALL';

my $kml_data = Geo::KML->from($kml_file);

#print ($kml_data);

получаю такое сообщение (часть) :

.........
trace: substitutionGroup {http://www.opengis.net/kml/2.2}AbstractFeatureGroup
  SG={http://www.opengis.net/kml/2.2}AbstractFeatureGroup (AbstractFeatureGroup)
  {http://www.google.com/kml/ext/2.2}Tour                Tour
  {http://www.opengis.net/kml/2.2}AbstractContainerGroup AbstractContainerGroup
  {http://www.opengis.net/kml/2.2}AbstractOverlayGroup   AbstractOverlayGroup
  {http://www.opengis.net/kml/2.2}Document               Document
  {http://www.opengis.net/kml/2.2}Folder                 Folder
  {http://www.opengis.net/kml/2.2}GroundOverlay          GroundOverlay
  {http://www.opengis.net/kml/2.2}NetworkLink            NetworkLink
  {http://www.opengis.net/kml/2.2}PhotoOverlay           PhotoOverlay
  {http://www.opengis.net/kml/2.2}Placemark              Placemark
  {http://www.opengis.net/kml/2.2}ScreenOverlay          ScreenOverlay
trace: using preparsed XML node <{http://www.opengis.net/kml/2.2}kml>
error: element `{http://www.opengis.net/kml/2.2}Document' not processed at {http://www.opengis.net/kml/2.2}kml
 at /usr/lib/perl5/site_perl/5.12.3/XML/Compile/Translate/Reader.pm line 608
XML::Compile::Translate::Reader::__ANON__(XML::Compile::Iterator=HASH(0x8d8771c)) at /usr/lib/perl5/site_perl/5.12.3/XML/Compile/Translate/Reader.pm line 497
XML::Compile::Translate::Reader::__ANON__(XML::Compile::Iterator=HASH(0x8d8771c)) at /usr/lib/perl5/site_perl/5.12.3/XML/Compile/Translate/Reader.pm line 92
XML::Compile::Translate::Reader::__ANON__(XML::LibXML::Element=SCALAR(0x8d67bb4)) at /usr/lib/perl5/site_perl/5.12.3/Geo/KML.pm line 187
Geo::KML::from("Geo::KML", "../../../doc/myplaces.kml") at ./parse_kml line 15

если парсить пример с сайта http://cpansearch.perl.org/src/MARKOV/Geo-KML-0.93/examples/doc.kml - все проходит нормально.

Как выловить причину? Может кто-то пробовал заниматься подобным?

Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.