Hi Monk how can i optimize the parser. its take 2.5 min to finish the job but cpu usage is 100% untill the job finish script. i have post a design and a small view of code
xml File open store on array of @lines(file contain record block) foreach line(@lines) #10Lakhs Line { $stringparse .=line # stringparse get the record (maybe of 100 lin +es which go to if block for parsing) IF(Endtags of block)# Execute 10000 times for each record($str +ingparse 100 lines xml) { $XML::LibXML::skipXMLDeclaration = 1; our $dom = XML::LibXML->load_xml(string => $stringparse); our $xml = $dom->documentElement; . . . #Some of use Api of my Code $method = $xml->getChildrenByTagName('Method')->to_literal; $Value = $xml->getChildrenByTagName("$Check")->to_literal; $bune = $xml->getChildrenByTagName('Number')->to_literal; if ($xml->findnodes('./Indi/Lost/true') ) { } if ( $xml->findnodes('./Indi/Lost/true') || $xml->findnodes('. +/Indi/Losgshshsht/false') ) { } if(($xml->findnodes('./nike'))[0]->firstChild){ ($xml->findnodes('./nike'))[0]->firstChild->setData($localS); } my $Tag =$dom->createElement('Nike_identifier') + $Tag->appendText($localS); $xml->addChild($Tag); $org= $xml->findnodes('./NikkooIdentifiers/abc')->to_literal; } }

In reply to Libxml parser cosuming 100% cpu by geek2882

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.