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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|