jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed monks,
I have a simple sub in my module which looks like this:
The file contains some XML which is in exactly the structure specified for the particular API I need to send it to:sub _view_xml { my $self = shift; my $xml = XMLin( "ttscall1.xml" ); print Dumper $xml; my $xml = XMLout( $xml, Rootname => 'campaign' ); print $xml; return $xml; }
When I dumpt the hash I get this:<campaign menuid="10118-2" action="0" > <phonenumbers > <phonenumber number="4167781583" callid="1234abc" > <prompts> <prompt promptid="2" tts="Hello, this is a test." /> </prompts > </phonenumber> </phonenumbers> </campaign>
Which is kinda what I expected. But when I ask for the XML back again, It gets compressed or something, and produces:$VAR1 = { 'menuid' => '10118-2', 'action' => '0', 'phonenumbers' => { 'phonenumber' => { 'number' => '4167781583', 'prompts' => { 'prompt' => { 'tts' => 'Hello, this is a test.', 'promptid' => '2' } }, 'callid' => '1234abc' } } };
How do I get XML::Simple to output the XML in the same form it was to begin with?<campaign action="0" menuid="10118-2"> <phonenumbers name="phonenumber" callid="1234abc" number="4167781583 +"> <prompts name="prompt" promptid="2" tts="Hello, this is a test." / +> </phonenumbers> </campaign>
What happens when I submit the XML to the API? I get this response:
. And I figure the same thing will happen for the <prompt> as well except it doesn;t get so far as parsing that yet.<?xml version="1.0"?><campaign errorid="16" comment="XML parse error: +PHONENUMBER tag missing or misplaced." />
Your assistance is appreciated! jdtoronto
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XML::Simple is doing too much for me! Help please.
by merlyn (Sage) on Jul 15, 2005 at 19:56 UTC | |
Re: XML::Simple is doing too much for me! Help please.
by runrig (Abbot) on Jul 15, 2005 at 19:29 UTC | |
Re: XML::Simple is doing too much for me! Help please.
by shiza (Hermit) on Jul 15, 2005 at 19:01 UTC | |
by jdtoronto (Prior) on Jul 15, 2005 at 19:10 UTC | |
by izut (Chaplain) on Jul 15, 2005 at 19:29 UTC | |
by jdtoronto (Prior) on Jul 15, 2005 at 19:42 UTC | |
Re: XML::Simple is doing too much for me! Help please.
by GrandFather (Saint) on Jul 16, 2005 at 06:45 UTC | |
by jdtoronto (Prior) on Jul 16, 2005 at 23:36 UTC |
Back to
Seekers of Perl Wisdom