Advanced XML rule example: Select node X if it exists and node Y if it does not

In this example, the expected value is normally found in a specific node, but if that node does not exist or is empty, you want Collector to take the value from another node. Example fields that you can look to for comparison are the TelephoneNumber, FaxNumber, and Email fields in a Svefaktura invoice.

  1. On the Fields tab of the XML Mapper (on the right side of the window), select the field that the rule will apply to. (If this field does not exist or is empty, a value will be extracted from a different node.)
    • Click the button to the right of the value:

      if no rule has been defined, or

      if there is already an existing rule for the field.

  2. Under XML node selection, navigate down to the parent node for both the expected value and the backup value, and click Select.
  3. Under XML node selected to work with, select the node for the expected value.
  4. Under Settings for new condition, select Node exists and click Add.
  5. Under Conditions to work with, select the condition that you just added.
  6. Under Settings to define how the invoice field value is set, select if condition is false.
  7. Select Use value from XML node and the secondary node in the box underneath it, and click Add.
  8. Select Use advanced rules.

Click Extract and review the image to check the results. If you need to modify the rule, you need to click it in the Rules applied to map this field box, click Del to delete it, make the changes needed to fix the rule, and click Add again to add the modified rule. If you need to modify a condition, the process is the same (and if a rule is based on it, the rule is also deleted if you delete the condition).

Consider if the change(s) should apply to all invoices or only those for the current XML invoice definition. Click Save XML definition to save the change for the current XML invoice definition only (that is, the current supplier). Click Save XML profile if you want the rule to apply to all XML invoices that match the XML invoice profile regardless of the XML invoice definition.

Other examples of advanced XML rules:

Correct a misspelled field name in connection with master data

Format an extracted XML value with XSL

Modify an extracted XML field value with XSL

Remove hyphens (-) from an extracted value

Select node X based on node Y (or on attribute a)

Select a specific node when more than one node matches after using a standard rule

Specify a constant value for a field

Summarize data from line items as a note in summary invoices

Translate an XML value to one that Kofax ReadSoft Invoices understands