http://www.perlmonks.org?node_id=481083

jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks,

If you are getting sick of my newbie XML questions I ask you to bear with me once more.

I started using XML::Simple becasue, in one programme I wrote it did just enough and did it rather well. But now I find that it is so simple that in fact it can't even do simple things. For example, using the XML that I will show you, it cannot parse it, then output the same thing! The documentation agrees with this and says, well, live with it or use something else. I can't live with it, so now I ask your advice as to how I go about doing just exactly what I need to do.

Here is the XML:

<?xml version="1.0" encoding="UTF-8" ?> <voice_broadcast_info xmlns="http://www.protus.com" xmlns:xsi="http:// +www.w3.org/2001/XMLSchema-instance"> <SchemaVersion>1.0</SchemaVersion> <login_key> <user_id>123456</user_id> <user_password>123456</user_password> </login_key> <voice_broadcast_options> <billing_code>TEST1000</billing_code> <start_hour>0</start_hour> <end_hour>23</end_hour> <release_date>2003-10-01T23:59:59</release_date> <in_house_flag>false</in_house_flag> <max_successful>0</max_successful> <delivery_type>both</delivery_type> </voice_broadcast_options> <voice_recipient_list> <voice_recipient> <voice_recipient_number>14169999999</voice_recipient_number> <voice_recipient_name>mE</voice_recipient_name> <voice_recipient_reference>bc-voice-1</voice_recipient_refere +nce> </voice_recipient> <voice_recipient> <voice_recipient_number>14169999999</voice_recipient_number> <voice_recipient_name>mE - 2</voice_recipient_name> <voice_recipient_reference>bc-voice-2</voice_recipient_refere +nce> </voice_recipient> </voice_recipient_list> <voice_answer_file vcast_file_content_type="audio/wav" vcast_file_e +ncoding_type="base64" vcast_file_name="live" vcast_file_extension="wav" delivery_answer_type="voice" vcast_fi +le_desc="TESTABC123"></voice_answer_file> <machine_answer_file vcast_file_content_type="audio/wav" vcast_file_e +ncoding_type="base64" vcast_file_name="live" vcast_file_extension="wav" delivery_answer_type="machine" vcast_ +file_desc="TESTABC123"></machine_answer_file> </voice_broadcast_info>
What I need to do is parse this to a Perl data structure and then modify it, outputting it in EXACTLY the same format. What I have given you above is merely a sample.

I am quite prepared to generate the entire thing programmatically. I had started out parsing these examples as an easy way of leveraging my effort - using them as templates in other words.

What should I be using in the way of modules?

jdtoronto