Differences

This shows you the differences between the selected revisions of the page.

2024-12-02 2024-12-02 (current)
1 (165.231.165.112) (hidden) (untrusted) msxsl is not available (martin)
Line 1: Line 1:
-317 
- 
- 
====== XML Logging ====== ====== XML Logging ======
XML logging is one of the WinSCP [[logging|log formats]]. An %%XML%% log includes structured records describing operations done by WinSCP over session. The log format is protocol independent. XML logging is one of the WinSCP [[logging|log formats]]. An %%XML%% log includes structured records describing operations done by WinSCP over session. The log format is protocol independent.
Line 22: Line 19:
An overall format of the %%XML%% log file follows: An overall format of the %%XML%% log file follows:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; +<?xml version="1.0" encoding="UTF-8"?> 
-&amp;lt;session xmlns=&amp;quot;http://winscp.net/schema/session/1.0&amp;quot; +<session xmlns="http://winscp.net/schema/session/1.0" 
-        name=&amp;quot;martin@example.com&amp;quot; start=&amp;quot;2009-03-02T19:34:57.734Z&amp;quot;&amp;gt; +        name="martin@example.com" start="2009-03-02T19:34:57.734Z"> 
-  &amp;lt;!-- operations --&amp;gt;   +  <!-- operations -->   
-&amp;lt;/session&amp;gt; +</session> 
-&amp;lt;/code&amp;gt;+</code>
-The top level ''session'' tag represents one logical session, which may consist of several physical sessions, particularly when connection is lost. Attribute ''name'' refers to name of the logical session. Attribute ''start'' indicates time when the session was initiated.((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD&amp;quot;T&amp;quot;HH:MM:SS.NNN&amp;quot;Z&amp;quot;%%'' syntax is used.))+The top level ''session'' tag represents one logical session, which may consist of several physical sessions, particularly when connection is lost. Attribute ''name'' refers to name of the logical session. Attribute ''start'' indicates time when the session was initiated.((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.))
The ''session'' element includes [[#elements|child elements]], where each element represents single log entry, i.e. single physical operation with remote file over the logical session. The ''session'' element includes [[#elements|child elements]], where each element represents single log entry, i.e. single physical operation with remote file over the logical session.
Line 46: Line 43:
Result of a specific operation is represented by child ''result'' element of respective operation element. The ''result'' element has boolean ''success'' attribute. Result of a specific operation is represented by child ''result'' element of respective operation element. The ''result'' element has boolean ''success'' attribute.
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +<result success="true" /> 
-&amp;lt;/code&amp;gt;+</code>
If ''success'' is ''false'', ''result'' element will typically include one or more ''message'' elements with error message(s). The error message is free text, that may be language-, protocol- or even server-specific. So you should not try to process it automatically. If ''success'' is ''false'', ''result'' element will typically include one or more ''message'' elements with error message(s). The error message is free text, that may be language-, protocol- or even server-specific. So you should not try to process it automatically.
The following example is from English version, connected with SFTP protocol to OpenSSH server: The following example is from English version, connected with SFTP protocol to OpenSSH server:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;result success=&amp;quot;false&amp;quot;&amp;gt; +<result success="false"> 
-  &amp;lt;message&amp;gt;Cannot open remote file '/home/user/examplefile.txt'.&amp;lt;/message&amp;gt; +  <message>Cannot open remote file '/home/user/examplefile.txt'.</message> 
-  &amp;lt;message&amp;gt;No such file or directory.+  <message>No such file or directory.
Error code: 2 Error code: 2
Error message from server: No such file Error message from server: No such file
-Request code: 3&amp;lt;/message&amp;gt; +Request code: 3</message> 
-&amp;lt;/result&amp;gt; +</result> 
-&amp;lt;/code&amp;gt;+</code>
With some protocols, each of the physical operations are performed individually. With some protocols, set of operations may be performed in atomic form. This may prevent mapping error to specific operation. In this case the error may be associated with more operations, resulting in its duplication in the %%XML%% log. With some protocols, each of the physical operations are performed individually. With some protocols, set of operations may be performed in atomic form. This may prevent mapping error to specific operation. In this case the error may be associated with more operations, resulting in its duplication in the %%XML%% log.
Line 74: Line 71:
If the particular error was associated with a physical operation, the error message will be included both in ''result'' child element of the respective operation element and in ''failure'' child element of top level ''session'' element or ''group'' element. If the particular error was associated with a physical operation, the error message will be included both in ''result'' child element of the respective operation element and in ''failure'' child element of top level ''session'' element or ''group'' element.
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;upload&amp;gt; +<upload> 
-  &amp;lt;filename value=&amp;quot;d:\examplefile.txt&amp;quot; /&amp;gt; +  <filename value="d:\examplefile.txt" /> 
-  &amp;lt;result success=&amp;quot;false&amp;quot;&amp;gt; +  <result success="false"> 
-    &amp;lt;message&amp;gt;Cannot create remote file '/home/user/examplefile.txt'.&amp;lt;/message&amp;gt; +    <message>Cannot create remote file '/home/user/examplefile.txt'.</message> 
-    &amp;lt;message&amp;gt;Permission denied.+    <message>Permission denied.
Error code: 3 Error code: 3
Error message from server: Permission denied Error message from server: Permission denied
-Request code: 3&amp;lt;/message&amp;gt; +Request code: 3</message> 
-  &amp;lt;/result&amp;gt; +  </result> 
-&amp;lt;/upload&amp;gt; +</upload> 
-&amp;lt;failure&amp;gt; +<failure> 
-  &amp;lt;message&amp;gt;Cannot create remote file '/home/user/examplefile.txt'.&amp;lt;/message&amp;gt; +  <message>Cannot create remote file '/home/user/examplefile.txt'.</message> 
-  &amp;lt;message&amp;gt;Permission denied.+  <message>Permission denied.
Error code: 3 Error code: 3
Error message from server: Permission denied Error message from server: Permission denied
-Request code: 3&amp;lt;/message&amp;gt; +Request code: 3</message> 
-&amp;lt;/failure&amp;gt; +</failure> 
-&amp;lt;/code&amp;gt;+</code>
===== [[group]] Grouping Operations for Commands ===== ===== [[group]] Grouping Operations for Commands =====
When using the %%XML%% logging together with [[scripting|scripting]], [[#elements|operations]] and [[#result_script|failures]] belonging to the same command can be grouped using parent ''group'' element: When using the %%XML%% logging together with [[scripting|scripting]], [[#elements|operations]] and [[#result_script|failures]] belonging to the same command can be grouped using parent ''group'' element:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;group name=&amp;quot;put -preservetime d:\*.txt&amp;quot; start=&amp;quot;2021-12-03T14:25:10.204Z&amp;quot;&amp;gt; +<group name="put -preservetime d:\*.txt" start="2021-12-03T14:25:10.204Z"> 
-  &amp;lt;upload&amp;gt; +  <upload> 
-    &amp;lt;filename value=&amp;quot;d:\readme.txt&amp;quot; /&amp;gt; +    <filename value="d:\readme.txt" /> 
-    &amp;lt;destination value=&amp;quot;/home/user/readme.txt&amp;quot; /&amp;gt; +    <destination value="/home/user/readme.txt" /> 
-    &amp;lt;size value=&amp;quot;15345&amp;quot; /&amp;gt; +    <size value="15345" /> 
-    &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +    <result success="true" /> 
-  &amp;lt;/upload&amp;gt; +  </upload> 
-  &amp;lt;upload&amp;gt; +  <upload> 
-    &amp;lt;filename value=&amp;quot;d:\examplefile.txt&amp;quot; /&amp;gt; +    <filename value="d:\examplefile.txt" /> 
-    &amp;lt;result success=&amp;quot;false&amp;quot;&amp;gt; +    <result success="false"> 
-      &amp;lt;message&amp;gt;Cannot create remote file '/home/user/examplefile.txt'.&amp;lt;/message&amp;gt; +      <message>Cannot create remote file '/home/user/examplefile.txt'.</message> 
-      &amp;lt;message&amp;gt;Permission denied.+      <message>Permission denied.
Error code: 3 Error code: 3
Error message from server: Permission denied Error message from server: Permission denied
-Request code: 3&amp;lt;/message&amp;gt; +Request code: 3</message> 
-    &amp;lt;/result&amp;gt; +    </result> 
-  &amp;lt;/upload&amp;gt; +  </upload> 
-  &amp;lt;failure&amp;gt; +  <failure> 
-    &amp;lt;message&amp;gt;Cannot create remote file '/home/user/examplefile.txt'.&amp;lt;/message&amp;gt; +    <message>Cannot create remote file '/home/user/examplefile.txt'.</message> 
-    &amp;lt;message&amp;gt;Permission denied.+    <message>Permission denied.
Error code: 3 Error code: 3
Error message from server: Permission denied Error message from server: Permission denied
-Request code: 3&amp;lt;/message&amp;gt; +Request code: 3</message> 
-  &amp;lt;/failure&amp;gt; +  </failure> 
-&amp;lt;/group&amp;gt; +</group> 
-&amp;lt;/code&amp;gt;+</code>
Grouping can be enabled on [[commandline#scripting|command-line]]. Grouping can be enabled on [[commandline#scripting|command-line]].
-//Grouping is particularly useful, when you are [[guide_interpreting_xml_log#continuous|continuously reading the XML log file]]. By receiving ''&amp;lt;/group&amp;gt;'' you know that the command execution has finished.//+//Grouping is particularly useful, when you are [[guide_interpreting_xml_log#continuous|continuously reading the XML log file]]. By receiving ''</group>'' you know that the command execution has finished.//
===== [[elements]] Elements ===== ===== [[elements]] Elements =====
Line 145: Line 142:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;call&amp;gt; +<call> 
-  &amp;lt;command value=&amp;quot;ps&amp;quot; /&amp;gt; +  <command value="ps" /> 
-  &amp;lt;destination value=&amp;quot;/home/user&amp;quot; /&amp;gt; +  <destination value="/home/user" /> 
-  &amp;lt;output value=&amp;quot;  PID TTY          TIME CMD+  <output value="  PID TTY          TIME CMD
16969 ?        00:00:00 sshd 16969 ?        00:00:00 sshd
16970 ?        00:00:00 sftp-server 16970 ?        00:00:00 sftp-server
32647 ?        00:00:00 bash 32647 ?        00:00:00 bash
- 1466 ?        00:00:00 ps&amp;quot; /&amp;gt; + 1466 ?        00:00:00 ps" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/call&amp;gt; +</call> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_call|call]]'' Associated script commands: ''[[scriptcommand_call|call]]''
Line 170: Line 167:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;checksum&amp;gt; +<checksum> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/index.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/index.html" /> 
-  &amp;lt;algorithm value=&amp;quot;sha-1&amp;quot; /&amp;gt; +  <algorithm value="sha-1" /> 
-  &amp;lt;checksum value=&amp;quot;bb4dfa9b51d3f6c99b5ec6c12ebf9cade79f43c4&amp;quot; /&amp;gt; +  <checksum value="bb4dfa9b51d3f6c99b5ec6c12ebf9cade79f43c4" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/checksum&amp;gt; +</checksum> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_checksum|checksum]]'' Associated script commands: ''[[scriptcommand_checksum|checksum]]''
Line 192: Line 189:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;chmod recursive=&amp;quot;true&amp;quot;&amp;gt; +<chmod recursive="true"> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/about.html" /> 
-  &amp;lt;permissions value=&amp;quot;rwxr-xr-x&amp;quot; /&amp;gt; +  <permissions value="rwxr-xr-x" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/chmod&amp;gt; +</chmod> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_chmod|chmod]]'', ''[[scriptcommand_keepuptodate|keepuptodate]] -permissions'', ''[[scriptcommand_put|put]] -permissions'', ''[[scriptcommand_synchronize|synchronize]] remote|both -permissions'' Associated script commands: ''[[scriptcommand_chmod|chmod]]'', ''[[scriptcommand_keepuptodate|keepuptodate]] -permissions'', ''[[scriptcommand_put|put]] -permissions'', ''[[scriptcommand_synchronize|synchronize]] remote|both -permissions''
Line 211: Line 208:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;cp&amp;gt; +<cp> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/about.html" /> 
-  &amp;lt;destination value=&amp;quot;/home/martin/backup/about.html.20171220&amp;quot; /&amp;gt; +  <destination value="/home/martin/backup/about.html.20171220" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/cp&amp;gt; +</cp> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_cp|cp]]'' Associated script commands: ''[[scriptcommand_cp|cp]]''
Line 231: Line 228:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;download&amp;gt; +<download> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/about.html" /> 
-  &amp;lt;destination value=&amp;quot;d:\www\about.htm&amp;quot; /&amp;gt; +  <destination value="d:\www\about.htm" /> 
-  &amp;lt;size value=&amp;quot;55387&amp;quot; /&amp;gt; +  <size value="55387" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/download&amp;gt; +</download> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_synchronize|synchronize]] local|both'' Associated script commands: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_synchronize|synchronize]] local|both''
Line 255: Line 252:
| ''type''                | Type of file as in Unix ''ls'' command output, e.g. ''d'' for directory (in ''value'' attribute) | | ''type''                | Type of file as in Unix ''ls'' command output, e.g. ''d'' for directory (in ''value'' attribute) |
| ''size''                | Size of file in bytes (in ''value'' attribute) | | ''size''                | Size of file in bytes (in ''value'' attribute) |
-| ''modification''        | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD&amp;quot;T&amp;quot;HH:MM:SS.NNN&amp;quot;Z&amp;quot;%%'' syntax is used.)) |+| ''modification''        | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)) |
| ''permissions''          | File permissions in Unix format ''rwxrwxrwx'' (in ''value'' attribute) | | ''permissions''          | File permissions in Unix format ''rwxrwxrwx'' (in ''value'' attribute) |
| ''owner''                | File owner (in ''value'' attribute) | | ''owner''                | File owner (in ''value'' attribute) |
Line 261: Line 258:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;ls&amp;gt; +<ls> 
-  &amp;lt;destination value=&amp;quot;/home/martin/public_html&amp;quot; /&amp;gt; +  <destination value="/home/martin/public_html" /> 
-  &amp;lt;files&amp;gt; +  <files> 
-    &amp;lt;file&amp;gt; +    <file> 
-      &amp;lt;filename value=&amp;quot;.&amp;quot; /&amp;gt; +      <filename value="." /> 
-      &amp;lt;type value=&amp;quot;d&amp;quot; /&amp;gt; +      <type value="d" /> 
-      &amp;lt;modification value=&amp;quot;2008-12-22T12:16:23.000Z&amp;quot; /&amp;gt; +      <modification value="2008-12-22T12:16:23.000Z" /> 
-      &amp;lt;permissions value=&amp;quot;rwxr-xr-x&amp;quot; /&amp;gt; +      <permissions value="rwxr-xr-x" /> 
-    &amp;lt;/file&amp;gt; +    </file> 
-    &amp;lt;file&amp;gt; +    <file> 
-      &amp;lt;filename value=&amp;quot;..&amp;quot; /&amp;gt; +      <filename value=".." /> 
-      &amp;lt;type value=&amp;quot;d&amp;quot; /&amp;gt; +      <type value="d" /> 
-      &amp;lt;modification value=&amp;quot;2008-03-25T08:15:53.000Z&amp;quot; /&amp;gt; +      <modification value="2008-03-25T08:15:53.000Z" /> 
-      &amp;lt;permissions value=&amp;quot;rwxr-xr-x&amp;quot; /&amp;gt; +      <permissions value="rwxr-xr-x" /> 
-    &amp;lt;/file&amp;gt; +    </file> 
-    &amp;lt;file&amp;gt; +    <file> 
-      &amp;lt;filename value=&amp;quot;.htaccess&amp;quot; /&amp;gt; +      <filename value=".htaccess" /> 
-      &amp;lt;type value=&amp;quot;-&amp;quot; /&amp;gt; +      <type value="-" /> 
-      &amp;lt;size value=&amp;quot;107&amp;quot; /&amp;gt; +      <size value="107" /> 
-      &amp;lt;modification value=&amp;quot;2008-12-02T06:59:58.000Z&amp;quot; /&amp;gt; +      <modification value="2008-12-02T06:59:58.000Z" /> 
-      &amp;lt;permissions value=&amp;quot;rw-r--r--&amp;quot; /&amp;gt; +      <permissions value="rw-r--r--" /> 
-    &amp;lt;/file&amp;gt; +    </file> 
-    &amp;lt;file&amp;gt; +    <file> 
-      &amp;lt;filename value=&amp;quot;about.html&amp;quot; /&amp;gt; +      <filename value="about.html" /> 
-      &amp;lt;type value=&amp;quot;-&amp;quot; /&amp;gt; +      <type value="-" /> 
-      &amp;lt;size value=&amp;quot;24064&amp;quot; /&amp;gt; +      <size value="24064" /> 
-      &amp;lt;modification value=&amp;quot;2007-10-04T21:43:02.000Z&amp;quot; /&amp;gt; +      <modification value="2007-10-04T21:43:02.000Z" /> 
-      &amp;lt;permissions value=&amp;quot;rw-r--r--&amp;quot; /&amp;gt; +      <permissions value="rw-r--r--" /> 
-    &amp;lt;/file&amp;gt; +    </file> 
-  &amp;lt;/files&amp;gt; +  </files> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/ls&amp;gt; +</ls> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_ls|ls]]'' Associated script commands: ''[[scriptcommand_ls|ls]]''
Line 306: Line 303:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;mkdir&amp;gt; +<mkdir> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/images&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/images" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/mkdir&amp;gt; +</mkdir> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_mkdir|mkdir]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_mkdir|mkdir]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both''
Line 324: Line 321:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;mv&amp;gt; +<mv> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/about.html" /> 
-  &amp;lt;destination value=&amp;quot;/tmp/about.bak&amp;quot; /&amp;gt; +  <destination value="/tmp/about.bak" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/mv&amp;gt; +</mv> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_mv|mv]]'' Associated script commands: ''[[scriptcommand_mv|mv]]''
Line 344: Line 341:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;rm recursive=&amp;quot;true&amp;quot;&amp;gt; +<rm recursive="true"> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/images&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/images" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/rm&amp;gt; +</rm> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_get|get]] -delete'', ''[[scriptcommand_keepuptodate|keepuptodate]] -delete'', ''[[scriptcommand_rm|rm]]'', ''[[scriptcommand_rmdir|rmdir]]'', ''[[scriptcommand_synchronize|synchronize]] local|both -delete'' Associated script commands: ''[[scriptcommand_get|get]] -delete'', ''[[scriptcommand_keepuptodate|keepuptodate]] -delete'', ''[[scriptcommand_rm|rm]]'', ''[[scriptcommand_rmdir|rmdir]]'', ''[[scriptcommand_synchronize|synchronize]] local|both -delete''
Line 362: Line 359:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;stat&amp;gt; +<stat> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/about.html" /> 
-  &amp;lt;file&amp;gt; +  <file> 
-    &amp;lt;type value=&amp;quot;-&amp;quot; /&amp;gt; +    <type value="-" /> 
-    &amp;lt;size value=&amp;quot;24064&amp;quot; /&amp;gt; +    <size value="24064" /> 
-    &amp;lt;modification value=&amp;quot;2007-10-04T21:43:02.000Z&amp;quot; /&amp;gt; +    <modification value="2007-10-04T21:43:02.000Z" /> 
-    &amp;lt;permissions value=&amp;quot;rw-r--r--&amp;quot; /&amp;gt; +    <permissions value="rw-r--r--" /> 
-  &amp;lt;/file&amp;gt; +  </file> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/stat&amp;gt; +</stat> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_stat|stat]]'' Associated script commands: ''[[scriptcommand_stat|stat]]''
Line 387: Line 384:
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;upload&amp;gt; +<upload> 
-  &amp;lt;filename value=&amp;quot;d:\www\about.htm&amp;quot; /&amp;gt; +  <filename value="d:\www\about.htm" /> 
-  &amp;lt;destination value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <destination value="/home/martin/public_html/about.html" /> 
-  &amp;lt;size value=&amp;quot;55387&amp;quot; /&amp;gt; +  <size value="55387" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/upload&amp;gt; +</upload> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]] remote|both''
Line 404: Line 401:
^ Element                  ^ Description ^ ^ Element                  ^ Description ^
| ''filename''            | Absolute path to remote file (in ''value'' attribute) | | ''filename''            | Absolute path to remote file (in ''value'' attribute) |
-| ''modification''        | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD&amp;quot;T&amp;quot;HH:MM:SS.NNN&amp;quot;Z&amp;quot;%%'' syntax is used.)) |+| ''modification''        | Modification timestamp (in ''value'' attribute)((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)) |
Example: Example:
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;touch&amp;gt; +<touch> 
-  &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +  <filename value="/home/martin/public_html/about.html" /> 
-  &amp;lt;modification value=&amp;quot;2008-12-28T11:22:19.000Z&amp;quot; /&amp;gt; +  <modification value="2008-12-28T11:22:19.000Z" /> 
-  &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +  <result success="true" /> 
-&amp;lt;/touch&amp;gt; +</touch> 
-&amp;lt;/code&amp;gt;+</code>
Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]] -preservetime'', ''[[scriptcommand_synchronize|synchronize]] remote|both'' Associated script commands: ''[[scriptcommand_keepuptodate|keepuptodate]]'', ''[[scriptcommand_put|put]] -preservetime'', ''[[scriptcommand_synchronize|synchronize]] remote|both''
Line 424: Line 421:
//Note that the ''[[#group|group]]'' elements will be included, if enabled only.// //Note that the ''[[#group|group]]'' elements will be included, if enabled only.//
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; +<?xml version="1.0" encoding="UTF-8"?> 
-&amp;lt;session xmlns=&amp;quot;http://winscp.net/schema/session/1.0&amp;quot; +<session xmlns="http://winscp.net/schema/session/1.0" 
-        name=&amp;quot;martin@example.com&amp;quot; start=&amp;quot;2012-01-04T14:25:53.173Z&amp;quot;&amp;gt; +        name="martin@example.com" start="2012-01-04T14:25:53.173Z"> 
-  &amp;lt;group name=&amp;quot;put -preservetime -permissions=644 d:\www\about.htm&amp;quot; start=&amp;quot;2012-01-04T14:28:45.393Z&amp;quot;&amp;gt; +  <group name="put -preservetime -permissions=644 d:\www\about.htm" start="2012-01-04T14:28:45.393Z"> 
-    &amp;lt;upload&amp;gt; +    <upload> 
-      &amp;lt;filename value=&amp;quot;d:\www\about.htm&amp;quot; /&amp;gt; +      <filename value="d:\www\about.htm" /> 
-      &amp;lt;destination value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +      <destination value="/home/martin/public_html/about.html" /> 
-      &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +      <result success="true" /> 
-    &amp;lt;/upload&amp;gt; +    </upload> 
-    &amp;lt;touch&amp;gt; +    <touch> 
-      &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +      <filename value="/home/martin/public_html/about.html" /> 
-      &amp;lt;modification value=&amp;quot;2008-12-28T11:22:19.000Z&amp;quot; /&amp;gt; +      <modification value="2008-12-28T11:22:19.000Z" /> 
-      &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +      <result success="true" /> 
-    &amp;lt;/touch&amp;gt; +    </touch> 
-    &amp;lt;chmod&amp;gt; +    <chmod> 
-      &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.html&amp;quot; /&amp;gt; +      <filename value="/home/martin/public_html/about.html" /> 
-      &amp;lt;permissions value=&amp;quot;rw-r--r--&amp;quot; /&amp;gt; +      <permissions value="rw-r--r--" /> 
-      &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +      <result success="true" /> 
-    &amp;lt;/chmod&amp;gt; +    </chmod> 
-  &amp;lt;/group&amp;gt; +  </group> 
-  &amp;lt;group name=&amp;quot;rm about.bak&amp;quot; start=&amp;quot;2012-01-04T14:28:47.892Z&amp;quot;&amp;gt; +  <group name="rm about.bak" start="2012-01-04T14:28:47.892Z"> 
-    &amp;lt;rm&amp;gt; +    <rm> 
-      &amp;lt;filename value=&amp;quot;/home/martin/public_html/about.bak&amp;quot; /&amp;gt; +      <filename value="/home/martin/public_html/about.bak" /> 
-      &amp;lt;result success=&amp;quot;false&amp;quot;&amp;gt; +      <result success="false"> 
-        &amp;lt;message&amp;gt;No such file or directory.+        <message>No such file or directory.
Error code: 2 Error code: 2
Error message from server: No such file Error message from server: No such file
-Request code: 13&amp;lt;/message&amp;gt; +Request code: 13</message> 
-      &amp;lt;/result&amp;gt; +      </result> 
-    &amp;lt;/rm&amp;gt; +    </rm> 
-    &amp;lt;failure&amp;gt; +    <failure> 
-      &amp;lt;message&amp;gt;No such file or directory.+      <message>No such file or directory.
Error code: 2 Error code: 2
Error message from server: No such file Error message from server: No such file
-Request code: 13&amp;lt;/message&amp;gt; +Request code: 13</message> 
-    &amp;lt;/failure&amp;gt; +    </failure> 
-  &amp;lt;/group&amp;gt; +  </group> 
-&amp;lt;/session&amp;gt; +</session> 
-&amp;lt;/code&amp;gt;+</code>
===== [[parse]] Interpreting/Parsing ===== ===== [[parse]] Interpreting/Parsing =====
Line 482: Line 479:
For example to generate a plain text list of successfully downloaded files from the following %%XML%% log (''log.xml''): For example to generate a plain text list of successfully downloaded files from the following %%XML%% log (''log.xml''):
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; +<?xml version="1.0" encoding="UTF-8"?> 
-&amp;lt;session xmlns=&amp;quot;http://winscp.net/schema/session/1.0&amp;quot; name=&amp;quot;user@host&amp;quot; start=&amp;quot;2021-12-03T06:45:57.008Z&amp;quot;&amp;gt; +<session xmlns="http://winscp.net/schema/session/1.0" name="user@host" start="2021-12-03T06:45:57.008Z"> 
-  &amp;lt;download&amp;gt; +  <download> 
-    &amp;lt;filename value=&amp;quot;/path/file1.txt&amp;quot; /&amp;gt; +    <filename value="/path/file1.txt" /> 
-    &amp;lt;destination value=&amp;quot;C:\path\file1.txt&amp;quot; /&amp;gt; +    <destination value="C:\path\file1.txt" /> 
-    &amp;lt;size value=&amp;quot;2022&amp;quot; /&amp;gt; +    <size value="2022" /> 
-    &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +    <result success="true" /> 
-  &amp;lt;/download&amp;gt; +  </download> 
-  &amp;lt;download&amp;gt; +  <download> 
-    &amp;lt;filename value=&amp;quot;/path/file2.txt&amp;quot; /&amp;gt; +    <filename value="/path/file2.txt" /> 
-    &amp;lt;destination value=&amp;quot;C:\path\file2.txt&amp;quot; /&amp;gt; +    <destination value="C:\path\file2.txt" /> 
-    &amp;lt;size value=&amp;quot;5782&amp;quot; /&amp;gt; +    <size value="5782" /> 
-    &amp;lt;result success=&amp;quot;true&amp;quot; /&amp;gt; +    <result success="true" /> 
-  &amp;lt;/download&amp;gt; +  </download> 
-&amp;lt;/session&amp;gt; +</session> 
-&amp;lt;/code&amp;gt;+</code>
use the following %%XSLT%% (''download.xslt''): use the following %%XSLT%% (''download.xslt''):
-&amp;lt;code xml&amp;gt; +<code xml> 
-&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; +<?xml version="1.0" encoding="UTF-8"?> 
-&amp;lt;xsl:stylesheet version=&amp;quot;1.0&amp;quot; xmlns:xsl=&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot; xmlns:winscp=&amp;quot;http://winscp.net/schema/session/1.0&amp;quot;&amp;gt; +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:winscp="http://winscp.net/schema/session/1.0"> 
-    &amp;lt;xsl:output method=&amp;quot;text&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;/&amp;gt; +    <xsl:output method="text" encoding="UTF-8"/> 
-    &amp;lt;xsl:strip-space elements=&amp;quot;*&amp;quot;/&amp;gt; +    <xsl:strip-space elements="*"/> 
-    &amp;lt;xsl:template match='winscp:download[winscp:result[@success=&amp;quot;true&amp;quot;]]/winscp:filename'&amp;gt; +    <xsl:template match='winscp:download[winscp:result[@success="true"]]/winscp:filename'> 
-        &amp;lt;xsl:value-of select=&amp;quot;@value&amp;quot;/&amp;gt; +        <xsl:value-of select="@value"/> 
-        &amp;lt;xsl:text&amp;gt;&amp;amp;#xa;&amp;lt;/xsl:text&amp;gt; +        <xsl:text>&#xa;</xsl:text> 
-    &amp;lt;/xsl:template&amp;gt; +    </xsl:template> 
-&amp;lt;/xsl:stylesheet&amp;gt; +</xsl:stylesheet> 
-&amp;lt;/code&amp;gt;+</code>
You can execute it using any %%XSLT%% processor: You can execute it using any %%XSLT%% processor:
-  * .NET [[dotnet&amp;gt;system.xml.xsl.xslcompiledtransform|''XslCompiledTransform'' class]], e.g. from PowerShell: \\ &amp;lt;code powershell&amp;gt;+  * .NET [[dotnet>system.xml.xsl.xslcompiledtransform|''XslCompiledTransform'' class]], e.g. from PowerShell: \\ <code powershell>
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform $xslt = New-Object System.Xml.Xsl.XslCompiledTransform
-$xslt.Load(&amp;quot;download.xslt&amp;quot;) +$xslt.Load("download.xslt") 
-$xslt.Transform(&amp;quot;log.xml&amp;quot;, &amp;quot;download.txt&amp;quot;)&amp;lt;/code&amp;gt; +$xslt.Transform("log.xml", "download.txt")</code> 
-  * [[https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home|Libxml2]] ''xsltproc.exe'': \\ &amp;lt;code&amp;gt;+  * [[https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home|Libxml2]] ''xsltproc.exe'': \\ <code>
xsltproc.exe download.xslt log.xml xsltproc.exe download.xslt log.xml
-&amp;lt;/code&amp;gt;+</code>
The output will be: The output will be:
-&amp;lt;code&amp;gt;+<code>
/path/file1.txt /path/file1.txt
/path/file2.txt /path/file2.txt
-&amp;lt;/code&amp;gt;+</code>
For a more complex example, see [[script_custom_listing_format_csv#scripting|*]]. For a more complex example, see [[script_custom_listing_format_csv#scripting|*]].
- 
-1 

Last modified: by martin