Howdy Monks

I am having a bit of a doozy problem with parsing out values of a KML.
I have managed to get the KML into a hash and print off the values I desire although the hash is breaking my KML structure apart.

The trouble is that each attribute is being placed as a seperate hash within the node.
This will present problems when I am trying to take my value, use it to return another value and place this value back into the KML at the correct place which is what I need.

I am currently using XML::Simple and suspect that this does not recognise attributes as attributes and I am struggling to comprehend if there are better parsers which will maintain my KML/XML structure?

Another problem which I seem to be having with XML::Simple is that the <name> element of the KML is not being preserved, the value is instead being used as the Hash key value and not preserving the value as the value of the <name> element! Again, is this an XML:Simple perculiarity and is it a known problem of XML parsers?

Any suggestions/explanations would be very useful,
Many thanks
Niall Carter


In reply to Using KML in XML::Simple by carterniall

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.