Brent Clark
Jun 30 2005, 01:10 PM
Hi all
I have a hash that I am trying to populate for XML::Simple
$fullXmlHash{$agentBookingSearch."BookRef_".$xmlData{'bookref'}} =
%xmlData;
This work perfectly and I get the info as so
<?xml version="1.0" standalone="yes" >
<opt>
<ebkBookRef_100122>
<booktime>17:20:58</booktime>
etc
<bookref>100122</bookref>
</ebkBookRef_100122>
<ebkBookRef_100243>
<booktime>13:37:07</booktime>
<billcode>B</billcode>
<sellcur>ZAR</sellcur>
etc
But now I need it to look like so
<?xml version="1.0" standalone="yes" >
<agentABC>
<ebkBookRef_100122>
<booktime>17:20:58</booktime>
etc
<bookref>100122</bookref>
</ebkBookRef_100122>
<ebkBookRef_100243>
<booktime>13:37:07</booktime>
<billcode>B</billcode>
<sellcur>ZAR</sellcur>
etc
I was hoping the following code will do the job
$fullXmlHash{$agentName}{$agentBookingSearch."BookRef_".$xmlData{'bookref'}}
= %xmlData;
But for some funny reason I still get the same output.
Would anyone have any idea or clue as to where im going wrong.
Kind Regards and thanks in advance
Brent Clark
P.s. My xml output is like so $xml->XMLout(%fullXmlHash, noattr =>
1,xmldecl => '<?xml version="1.0" standalone="yes" >');
Wiggins d'Anconia
Jun 30 2005, 01:51 PM
Brent Clark wrote:
QUOTE |
Hi all
I have a hash that I am trying to populate for XML::Simple
$fullXmlHash{$agentBookingSearch."BookRef_".$xmlData{'bookref'}} = %xmlData;
This work perfectly and I get the info as so <?xml version="1.0" standalone="yes" <opt <ebkBookRef_100122 <booktime>17:20:58</booktime etc <bookref>100122</bookref </ebkBookRef_100122 <ebkBookRef_100243 <booktime>13:37:07</booktime <billcode>B</billcode <sellcur>ZAR</sellcur etc
But now I need it to look like so
<?xml version="1.0" standalone="yes" <agentABC
|
Is the above the only difference? You didn't state clearly what the
problem was, and that was the only difference I could see.
If the root name is the only problem, you can use the 'RootName' option
to provide you 'agentABC' string. Check the docs,
perldoc XML::Simple
[snip]
QUOTE |
Kind Regards and thanks in advance Brent Clark
|
Brent Clark
Jul 1 2005, 07:38 AM
Grant McLean wrote:
QUOTE |
If I understand your question correctly, I think you need to use the RootName option.
|
Hi Grant / list
thanks for your reply.
I actually need to agentABC to one less than the root.
Therefore Im trying to get it as so.
<root>
<agentName>
<bookingNumber>
<details>etc</details>
<moredetails>etc</moredetails>
</bookingNumber>
<anotherBookingNumber>
<details>etc</details>
<moredetails>etc</moredetails>
</anotherBookingNumber>
</agentName>
<anotherAgentName>
<bookingNumber>
<details>etc</details>
<moredetails>etc</moredetails>
</bookingNumber>
<anotherBookingNumber>
<details>etc</details>
<moredetails>etc</moredetails>
</anotherBookingNumber>
</anotherAgentName>
etc etc etc
</root>
Currently I have the bookingNumber / s etc
Im hoping you or someone will be able to understand.
Again, thank for your reply
Kind Regards
Brent Clark
Brent Clark
Jul 1 2005, 08:14 AM
Grant McLean wrote:
QUOTE |
Perhaps instead of ...
$xml->XMLout(%fullXmlHash, ...
.. you might be looking for:
$xml->XMLout( { "agentName" => %fullXmlHash} } , ...
|
Ahh brilliant
this is how it currently is
<?xml version="1.0" standalone="yes" >
<opt>
<agentName>
<ltsBookRef_100756>
<booktime>12:51:59</booktime>
<billcode></billcode>
<sellcur>ZAR</sellcur>
<audituser>tbrink</audituser>
so im one step closer to gettting this right.
the problem is I have not one agentnames. but a few
I need to try and get it as so
<agentNameOne>
<ltsBookRef_100756>
<booktime>12:51:59</booktime>
<billcode></billcode>
<sellcur>ZAR</sellcur>
<audituser>tbrink</audituser>
</agentNameOne>
<agentNameTwo>
etc tags for agent two
</agentNameTwo>
<agentNameTwo>
etc tags for agent three
</agentNameTwo>
A big thanks to replying to me.
Really appreciate this.
Kind Regards
Brent Clark
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.