Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Problem in parsing XML file using XMl::Twigby mirod (Canon) |
on Aug 16, 2005 at 22:55 UTC ( [id://484271]=note: print w/replies, xml ) | Need Help?? |
Actually what should happen (I did not run the code) is that your program prints the modified element in books.xml for each title (from the element->print in the loop, then prints the entire books.xml resulting from the last loop, where indeed only 'Learning Perl on Win32 Systems' has been updated. What are you trying to do exactly? The example seems really contrived. In any case, your existing code processes books.xml and awfull lots of time (once per title)! If you really wanted to do this you should parse the first file, changing the titles and storing a hash old_title => new title (if memory is a problem you can use twig_roots / purge during the parse and tie the hash to a DBM file), then parse the second file, and replace each title found in the hash by the value (once again using twig_roots / purge if memory is tight). Does this help?
In Section
Seekers of Perl Wisdom
|
|