Difference between revisions of "OS4X plugin os4xplugin manipulate xml"

From OS4X
Jump to navigation Jump to search
Line 12: Line 12:
 
*Create non-existing target XPath: if the last node of the target XPath is not-existant, the plugin will create it.
 
*Create non-existing target XPath: if the last node of the target XPath is not-existant, the plugin will create it.
  
 +
== Behaviour ==
 +
*The exact same amount of source XPath results must exist as the amount of target XPath results
 +
**If you modify files in a job, you can only modify target XPaths of the same amount, which is normally a file target XPath.
 +
*The source XPath must be a XML node containing text. Empty text sources lead to a plugin error which aborts the job.
 +
*If the target text is empty, the plugin exits with an error and the job aborts.
 +
*When dealing with multiple XML results for source and target XPath expressions, the calculated target value is always put in the same XML structure where source source is located (but with calculated values of the corresponding node, see examples below).
  
 
== Examples ==
 
== Examples ==

Revision as of 09:52, 27 July 2017

Purpose

Manipulate job XML nodes via regular expressions, based on the content of the same or other XML nodes of the job XML.

Requirements

  • OS4X Enterprise license

Configuration

  • Source XPath: the source XPath expression of a XML node which contains the source text information.
  • Modification regular expression: the Perl regular expression (preg) rule which defines the result text, based on the source XML node text.
  • Target XPath: the target XPath expression, where the target extrapolated information is stored.
  • Create non-existing target XPath: if the last node of the target XPath is not-existant, the plugin will create it.

Behaviour

  • The exact same amount of source XPath results must exist as the amount of target XPath results
    • If you modify files in a job, you can only modify target XPaths of the same amount, which is normally a file target XPath.
  • The source XPath must be a XML node containing text. Empty text sources lead to a plugin error which aborts the job.
  • If the target text is empty, the plugin exits with an error and the job aborts.
  • When dealing with multiple XML results for source and target XPath expressions, the calculated target value is always put in the same XML structure where source source is located (but with calculated values of the corresponding node, see examples below).

Examples

Scenario 1: change virtual filename based on real filename

Filename example:

Yanfeng_DESADV.dat
  • Source XPath: /OS4X_job/job_information/job_file/real_filename
  • Modification regular expression: .*_(.*)..*
  • Target XPath: /OS4X_job/job_information/job_file/virtual_filename

Plugin output:

Source XPath: '/OS4X_job/job_information/job_file/real_filename'.
Modifying regular expression: '.*_(.*)\..*'.
Target XPath: '/OS4X_job/job_information/job_file/virtual_filename'.

Source information #1: [Yanfeng_DESADV.dat]
Replacement of regular expression #1: [DESADV]
Target XPath expression found with one resultset.