<br>Hi everyone,<br>Need your help once again<br><br>I have a a kml file for parsing (please find the attachment below) I have used XML::Simple for parsing & for storing the value by hash array(key, value).<br><br>Below is the code::<br>
******************************************************************************************<br>
#!/usr/bin/perl<br>use XML::Simple;<br>use Data::Dumper; <br><br>my $file = 'Al waab B villa.kml';<br><br>#create a object<br>my $xm1 = XML::Simple->new();<br><br>#read XML file<br>my $data = $xm1->XMLin("Al waab B villa.kml");<br>
<br>print Dumper($data);<br><br>my $tags = $data->{Document}->{Placemark}->{LookAt};<br>my %hash;<br>my $val;<br><br>foreach $val (keys %$hello) {<br>push @{$hash{$tags}}, $val;<br> }<br>print Dumper \%hash;<br>
<br>******************************************************************************************<br><br>I get output as:<br><br><br>$VAR1 = {<br> 'HASH(0x1ad903c)' => [<br> 'longitude',<br>
'latitude',<br> 'heading',<br> 'tilt',<br> 'range',<br> 'altitudeMode',<br>
'altitude'<br> ]<br> };<br><br><br>For a single key I want tag values between them not the name.<br><br>And I want output as::(with a pipe operator between each value)<br>
<br>LookAt => 51.47891287538003|25.26764114641654|0|3709.372423858944|0-0.002617566196780602|relativeToGround<br><br> wating for your replies.<br>Thanks in advance. <br><div class="gmail_quote">On Sun, Jun 14, 2009 at 10:57 PM, sairam pareek <span dir="ltr"><<a href="mailto:mariassai@gmail.com" target="_blank">mariassai@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks for your replies,<br>
<br>
I m happy to be in this group, I tried the given solutions, they are working fine.<br>
<br>
If I have some problem further Ill let you know.<br><br>Thanks once again.<div><div></div><div><br><br><div class="gmail_quote">On Sun, Jun 14, 2009 at 10:02 PM, simran <span dir="ltr"><simran@tlims.cc></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
probably best to use the XML::Simple module... <br><div><br><a href="http://search.cpan.org/%7Egrantm/XML-Simple-2.18/lib/XML/Simple.pm" target="_blank">http://search.cpan.org/~grantm/XML-Simple-2.18/lib/XML/Simple.pm</a><br>
<br></div><div class="gmail_quote">
2009/6/15 wolf <span dir="ltr"><<a href="mailto:superpulse.x@gmail.com" target="_blank">superpulse.x@gmail.com</a>></span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hey,<br><br>I used your KML file ( renamed it of course ):<br> <br>cat test.kml | perl -ne ' print "$1: $2\n " if m!<(longitude|latitude)\s*?>\s*?([0-9\.]+)\s*?!'<br><br>Hope this helps,<br>
<br>Cheers,<br>V<br><br><br><div class="gmail_quote">2009/6/14 sairam pareek <span dir="ltr"><<a href="mailto:mariassai@gmail.com" target="_blank">mariassai@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div>
Hello everyone.<br><br>I have a kml file, and struggling to write a perl script to parse its value between tags, this is my first task.<br>and the second is to update the value between the tag in the postgresql database table. I m attaching the KML file, Please find the attachment. (I want to parse the longitude, latitude vlaues in these) <br>
<br> Please help me, its urgent. Waiting for your replies. Hoping for great help from you guys. I wanted to use regular expression for this. I found this group on orkut.<br>
Thanks in advance.<br><br>Regards, <br>Sairam <br><font color="#888888"><br>-- <br>"It is not how much you do, but how much love you put in the doing."<br>
</font><br></div></div>_______________________________________________<br>
Bangalore-pm mailing list<br>
<a href="mailto:Bangalore-pm@pm.org" target="_blank">Bangalore-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/bangalore-pm" target="_blank">http://mail.pm.org/mailman/listinfo/bangalore-pm</a><br></blockquote></div><br>
<br>_______________________________________________<br>
Bangalore-pm mailing list<br>
<a href="mailto:Bangalore-pm@pm.org" target="_blank">Bangalore-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/bangalore-pm" target="_blank">http://mail.pm.org/mailman/listinfo/bangalore-pm</a><br></blockquote></div></div></div><br>
</blockquote></div><br><br clear="all"><br>-- <br>"It is not how much you do, but how much love you put in the doing."<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>"It is not how much you do, but how much love you put in the doing."<br>