I have an XML File

<response> <version>0.1</version> <termsofService>http://www.medline.com/</termsofService> <features> <feature>history</feature> </features> <history> <observations> <observation> <Date PubStatus="entrez"> <Year>2010</Year> <Month>6</Month> <Day>18</Day> <Hour>6</Hour> <Minute>0</Minute> </Date> <PublicationStatus>aheadofprint</PublicationStatus> <Initials>JJ</Initials> <NlmUniqueID>8434563</NlmUniqueID> </observation> <observation> <Date PubStatus="entrez"> <Year>2011</Year> <Month>4</Month> <Day>18</Day> <Hour>10</Hour> <Minute>20</Minute> </Date> <PublicationStatus>aheadofprint</PublicationStatus> <Initials>BP</Initials> <NlmUniqueID>9814863</NlmUniqueID> </observation> </observations> </history> </response>

I want to extract everything under the observation tag. I was able to parse a simple XML file using XML::Simple and only one observation tag and get the output but I am not able to extract information off of repetitive multi level tags containing repetitive tags. Please help me figure it out. Thanks, Gouri


In reply to Extracting from repetitive multi level tags containing repetitive tags using Perl by Gouri

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.