Seon plugin seonplugin manipulate xml

From Seon
Jump to: navigation, search

Purpose

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

Requirements

  • Seon 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 in job:

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

Plugin output:

Source XPath: '/Seon_job/job_information/job_file/real_filename'.
Modifying regular expression: '.*_(.*)\..*'.
Target XPath: '/Seon_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.

Scenario 2: change virtual filename based on real filename (multiple files in job)

Filename examples in job:

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

Plugin output:

Source XPath: '/Seon_job/job_information/job_file/real_filename'.
Modifying regular expression: '.*_(.*)\..*'.
Target XPath: '/Seon_job/job_information/job_file/virtual_filename'.
Creating non-existing target XPath has been configured as true.

Source information #1: [Other_DELIVERY.dat]
Replacement of regular expression #1: [DELIVERY]
Target XPath expression found with 2 resultsets.

Source information #2: [Yanfeng_DESADV.dat]
Replacement of regular expression #2: [DESADV]
Target XPath expression found with 2 resultsets.

Relevant job XML nodes changed (after plugin exection):

<job_file>
   <real_filename>Other_DELIVERY.dat</real_filename>
   <virtual_filename>DELIVERY</virtual_filename>
</job_file>
<job_file>
   <real_filename>Yanfeng_DESADV.dat</real_filename>
   <virtual_filename>DESADV</virtual_filename>
</job_file>

Scenario 3: create new XML node based on real filename

Filename examples in job:

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

Plugin output:

Source XPath: '/Seon_job/job_information/job_file/real_filename'.
Modifying regular expression: '.*_(.*)\..*'.
Target XPath: '/Seon_job/job_information/job_file/my_own_node'.
Creating non-existing target XPath has been configured as true.

Source information #1: [Yanfeng_DESADV.dat]
Replacement of regular expression #1: [DESADV]
Retrying with XPath [/Seon_job/job_information/job_file]...
Target XPath expression found with one resultset.
Appending XML node: [my_own_node]

Relevant job XML nodes changed (after plugin exection):

<job_file>
   ...
   <my_own_node>DESADV</my_own_node>
</job_file>