I have a hash of the form
my $hash = {
'Key' => "ID1",
'Value' => "SomeProcess"
};
I need to convert this to an XML fragment of the form
<Parameter key="ID1">Some Process a</Parameter>
<Parameter key="ID2">Some Process b</Parameter>
<Parameter key="ID3">Some Process c</Parameter>
How can this be done?
First of all, your sample is not a valid XML document, so XML::Simple takes a little jury-rigging in order to output it. It seems to expect to output documents, not so much fragments. But I was able to generate that output with this structure:
Just keep in mind that XML::Simple will not be able to read that back in.
Here's the output:
So if you can get your structure into the form I showed you, you would be able to print out your fragment with the
RootName => ''
parameter.So, given your format, something like this might work: