SmilingBuddha has asked for the wisdom of the Perl Monks concerning the following question:
I have some data in XML format:
<job_def> <entry name="DCMAKE"> <option name="QUEUE">batch</option> <option name="RAM">100</option> <option name="LICENSE"> <member> <arg name="NAME">qhvsim</arg> <arg name="NUMBER">1</arg> <arg name="DURATION">2</arg> </member> <member> <arg name="NAME">synopsys</arg> <arg name="NUMBER">1</arg> <arg name="DURATION">3</arg> </member> </option> <option name="RUN_OS"> <member>SUNSOL_58</member> <member>LINUX72</member> </option> </entry> </job_def>
I need to process the above data using some Perl XML parser with the following constraints:
1) I have certain checks that I need to apply on the above data (using DTD).
2) Also, in the above example the user may or may not give certain "arg" names and values for example "NUMBER". In that case I need to take some default value (present in the XML file itself).
3) Also, as can be seen above I need a parser which supports different structures for different "options". For example: option QUEUE takes a scalar value, option LICENSE takes a hash-like structure and option RUN_OS takes an array-like structure.
I was using XML::Simple until now, but that doesn't do anything about DTD nor about default values. My question to you wise monks is how do I go about chossing the XML parser/checker with the above constraints. Any specific names will be greatly appreciated.