I have an XML file that is used as index for a dynamic panel with this structure:
<?xml version="1.0"?>
<Addons>
<line>
<text>My collection 1</text>
<level>3</level>
<comment/>
<file>Collection1.zip</file>
<size>120</size>
<parent>Collection</parent>
<directory>picture</directory>
<type>jpeg</type>
<filedate>22/05/2014</filedate>
</line>
<line>
<text>My collection 2</text>
<level>3</level>
<comment/>
<file>Collection2.zip</file>
<size>880</size>
<parent>Collection</parent>
<directory>picture</directory>
<type>jpeg</type>
<filedate>01/04/2013</filedate>
</line>
</Addons>
My panel uses this file as building index. When I update the files on the server, I need to update the filedate element by hand, ...but the file has 80 lines and it's terrible.
Is there a way by a script to do the job? The sequence is:
- parse the file line by line
- read the file name from the
<file>element - get the last-modification date of the file
- update the
<filedate>element if present - go to next line
Shell scripts and Python are available on the server.
Thanks!!
xsltprocor similar?