|
|
|
@ -5,18 +5,17 @@ use strict; |
|
|
|
|
use warnings; |
|
|
|
|
|
|
|
|
|
use XML::LibXML; |
|
|
|
|
use Data::Dumper; |
|
|
|
|
use URI::Escape; |
|
|
|
|
|
|
|
|
|
my ($name, $coordinates, $article) = @ARGV; |
|
|
|
|
my ($name, $coordinates) = @ARGV; |
|
|
|
|
|
|
|
|
|
my $filename = 'ours.kml'; |
|
|
|
|
my $dom = XML::LibXML->load_xml(location => $filename, no_blanks => 1); |
|
|
|
|
my $xpc = XML::LibXML::XPathContext->new($dom); |
|
|
|
|
$xpc->registerNs('k', "http://earth.google.com/kml/2.2"); |
|
|
|
|
|
|
|
|
|
append_placemark($name, $coordinates, $article); |
|
|
|
|
append_placemark($name, $coordinates, uri_escape($name)); |
|
|
|
|
|
|
|
|
|
# say $dom->toString(1); |
|
|
|
|
print $dom->toString(1); |
|
|
|
|
|
|
|
|
|
sub add_empty_child |
|
|
|
@ -50,6 +49,11 @@ sub append_placemark |
|
|
|
|
my $name_cdata = $dom->createCDATASection($name_content); |
|
|
|
|
$name_node->appendChild($name_cdata); |
|
|
|
|
|
|
|
|
|
my $description_node = add_empty_child($placemark, 'description'); |
|
|
|
|
my $description_content = $coordinates; |
|
|
|
|
my $description_cdata = $dom->createCDATASection($description_content); |
|
|
|
|
$description_node->appendChild($description_cdata); |
|
|
|
|
|
|
|
|
|
my $style_node = add_empty_child($placemark, 'styleUrl'); |
|
|
|
|
$style_node->appendText('#jackpoint-logo'); |
|
|
|
|
|
|
|
|
|