|
|
|
@ -7,18 +7,17 @@ use warnings; |
|
|
|
|
use XML::LibXML; |
|
|
|
|
use Data::Dumper; |
|
|
|
|
|
|
|
|
|
my ($name, $coordinates, $article) = @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("Fo'o", '-122,47', 'Fo%27o'); |
|
|
|
|
append_placemark("Bar", '-122.5,47.5'); |
|
|
|
|
append_placemark($name, $coordinates, $article); |
|
|
|
|
|
|
|
|
|
# say $dom->toString(1); |
|
|
|
|
open TEST_KML, ">test.kml"; |
|
|
|
|
print TEST_KML $dom->toString(1); |
|
|
|
|
close TEST_KML; |
|
|
|
|
print $dom->toString(1); |
|
|
|
|
|
|
|
|
|
sub add_empty_child |
|
|
|
|
{ |
|
|
|
|