in reply to Re: XML::Simple Output
in thread XML::Simple Output
Why does this module require two attributes to be set in order to make output have the same structure as input?
XML::Simple is optimised for reading XML. Some of the things it does to make your life easier when it reads XML make things more difficult if you try and write XML back out again. But if you're anything like me then you read XML far more often than you write it. The two operations have very little in common so one tool is unlikely to be well suited to both.
I'd be the first to admit that the XML::Simple API is a mess. The primary reason is that it wasn't planned as a general purpose XML manipulation tool. It was designed for reading XML config files. The code to write XML back out again was added on later. If I had set out to write a tool that could round-trip XML perfectly every time then I would have ended up designing some sort of DOM-type thing and at some point I would have seen the error of my ways and given up.
I'd say this is rapidly becoming a Frequently Asked Question
Perhaps, but I'd wager that most people who are asking have not read the XML::Simple documentation sitting on their own hard drive, or the XML::Simple FAQ sitting next to it. The original poster for example had a choice of 22 options and apparently didn't even try one! The ForceArray option which would be one solution to the original question is even singled out in the documentation as one of the two most important options you need to read about before you use the module. You can lead a horse to water ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: XML::Simple Output
by Cody Pendant (Prior) on Nov 19, 2003 at 20:30 UTC | |
by grantm (Parson) on Nov 20, 2003 at 01:00 UTC | |
by Cody Pendant (Prior) on Nov 20, 2003 at 20:17 UTC |