Okay:

Here is the code:

sub CamPatData { my $obj = shift; Date_Init("TZ=EST"); if (@_) { my $file = shift; my $parser = XML::DOM::Parser->new(); my $doc = $parser->parsefile($file); my (@patdemo); my ($ln, $fn, $sex, $dob, $htu, $htn, $wtu, $wtn, $patnum, $pa +tient); #Get Patient Data foreach $patient($doc->getElementsByTagName('SA_PATIENT')) { $ln = $patient->getElementsByTagName('MY_LAST_NAME')->item +(0)->getFirstChild->getNodeValue; $fn = $patient->getElementsByTagName('MY_FIRST_NAME')->ite +m(0)->getFirstChild->getNodeValue; $dob = $patient->getElementsByTagName('MY_BIRTH_DATE')->it +em(0)->getFirstChild->getNodeValue; $sex = $patient->getElementsByTagName('MY_GENDER')->item(0 +)->getFirstChild->getNodeValue; $dob = $patient->getElementsByTagName('MY_BIRTH_DATE')->it +em(0)->getFirstChild->getNodeValue; } foreach $patient($doc->getElementsByTagName('CathStudy')) { $htn = $patient->getElementsByTagName('PatHeight')->item(0 +)->getFirstChild->getNodeValue; $htu = $patient->getElementsByTagName('PatHeight')->item(0 +)->getAttribute('Units'); $wtn = $patient->getElementsByTagName('PatWeight')->item(0 +)->getFirstChild->getNodeValue; $wtu = $patient->getElementsByTagName('PatWeight')->item(0 +)->getAttribute('Units'); $patnum = $patient->getElementsByTagName('StudyID')->item( +0)->getFirstChild->getNodeValue; } #Rounding Off $wtn = ceil($wtn); $htn = ceil($htn); my $date = ParseDate($dob); $dob = UnixDate($date,"%m/%d/%Y"); @patdemo = ($ln, $fn, $dob, $sex, $htn, $htu, $wtn, $wtu, $pat +num); }

Here is the Sample Data:

</CathStudy> <SA_PATIENT> <MY_PATIENT_ID>XXXXX</MY_PATIENT_ID> <MY_BIRTH_DATE>123-45-6789</MY_BIRTH_DATE> <MY_FIRST_NAME>BERT</MY_FIRST_NAME> <MY_GENDER>M</MY_GENDER> <MY_LAST_NAME>PUPPET</MY_LAST_NAME> <Address>123 SESAME ST</Address> <City>NEW YORK</City> <State>NY</State> <Zip>10110</Zip> <Race>Caucasian</Race> </SA_PATIENT>

Any suggestions?


In reply to Re^2: Rewriting XML::DOM based module as XML::SAX by Cappadonna3030
in thread Rewriting XML::DOM based module as XML::SAX by Cappadonna3030

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.