Ask Your Question

Revision history [back]

You can use Jython ElementTree for this. For example, if your records have a name field, and you want an XML person element with a name sub-element, you can use the Jython evaluator with the following script:

from xml.etree import ElementTree as etree

for record in records:
  try:
    # Make element tree
    person = etree.Element("person")
    name = etree.SubElement(person, "body")
    name.text = record.value['name']

    # Put XML in the record
    record.value['xml'] = etree.tostring(person)

    output.write(record)

  except Exception as e:
    # Send record to error
    error.write(record, str(e))

This results in output like: image description

click to hide/show revision 2
No.2 Revision

You can use Jython ElementTree for this. For example, if your records have a name field, and you want an XML person element with a name sub-element, you can use the Jython evaluator Evaluator with the following script:

from xml.etree import ElementTree as etree

for record in records:
  try:
    # Make element tree
    person = etree.Element("person")
    name = etree.SubElement(person, "body")
    name.text = record.value['name']

    # Put XML in the record
    record.value['xml'] = etree.tostring(person)

    output.write(record)

  except Exception as e:
    # Send record to error
    error.write(record, str(e))

This results in output like: image description

click to hide/show revision 3
No.3 Revision

You can use Jython ElementTree for this. For example, if your records have a name field, and you want an XML person element with a name sub-element, you can use the Jython Evaluator Evaluator with the following script:

from xml.etree import ElementTree as etree

for record in records:
  try:
    # Make element tree
    person = etree.Element("person")
    name = etree.SubElement(person, "body")
    name.text = record.value['name']

    # Put XML in the record
    record.value['xml'] = etree.tostring(person)

    output.write(record)

  except Exception as e:
    # Send record to error
    error.write(record, str(e))

This results in output like: image description