Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Problem in parsing XML file using XMl::Twig

by mirod (Canon)
on Aug 16, 2005 at 22:55 UTC ( [id://484271]=note: print w/replies, xml ) Need Help??


in reply to Problem in parsing XML file using XMl::Twig

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?

  • Comment on Re: Problem in parsing XML file using XMl::Twig

Replies are listed 'Best First'.
Re^2: Problem in parsing XML file using XMl::Twig
by ramya2005 (Scribe) on Aug 17, 2005 at 18:13 UTC
    Thanks that tip helps!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://484271]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found