CreateJobsFromXML

A step based on this step template lets you create one or more XML jobs from the contents of an XML input file. The step submits the jobs to a workflow that you specify.

Job property defaults

  • XML input file: ${getCurrentFile(xml)}
  • XPath expression to create jobs:
  • Create as child job: Yes
  • Workflow for new jobs:
  • Stop when no matching elements: No

Usage notes

  • The step lets you create XML jobs from the elements in an XML input file that match an XPath expression.
  • You can use any valid XPath expression. For example:
    • A publishing company uses this XPath expression to create jobs for all books with more than 100 pages:

      /bookstore/book[pages>100]/pages

    • A print shop uses this XPath expression to create jobs for each of the poster and business-card elements in an XML input file:

      //order/poster | //order/businesscards

  • A workflow can run two or more CreateJobsFromXML steps on the same XML input file, and each step can use a different value for the XPath expression to create jobs property.

    For example, a workflow receives an XML input file containing an order for both printable items and inventory items (such as coffee mugs and baseball caps). One branch of the workflow processes the printable items, and another branch processes the inventory items. The CreateJobsFromXML step in the first branch uses an XPath expression to find all elements that contain the printable items in the order. The CreateJobsFromXML step in the second branch uses an XPath expression to find all elements that contain the inventory items.

  • The XML input file can be the job file in the spool directory or a file stored at another location on the system.
    • If it is the job file, keep the default value for the XML input file property.

    • If it is stored at another location, specify the full path and file name as the value of the XML input file property.

      When the XML input file is stored at another location, the file does not become part of the job that the CreateJobsFromXML step processes. The step reads the information in the file, uses the information to create XML files, and submits those XML files as jobs.

  • The values of the XPath expression to create jobs property and the Workflow for new jobs property are optional when you specify step properties, but they are required when the CreateJobsFromXML step runs.

    The values can be set as input to a step ahead of a CreateJobsFromXML step in a workflow. For example, you can put an AssignJobValues step ahead of the CreateJobsFromXML step. Create a configuration file that sets the values of these properties. On the AssignJobValues step, specify the configuration file as the value of the Job values file property. Because the XPath expression to create jobs property and the Workflow for new jobs property are positional job properties, you cannot set their values by using the Values to set property on the AssignJobValues step.

  • The value of the Create as child job property determines whether this step creates child jobs or independent jobs.