Working with XML in the Automation Engine

Document created by Michael_Lowry on Dec 3, 2018Last modified by Michael_Lowry on Dec 4, 2018
Version 5Show Document
  • View in full screen mode

There are two ways of storing XML in the Automation Engine:

  • XML VARA objects
  • Structured documentation tabs

 

XML VARA objects

XML VARA objects were introduced in v11. Each XML VARA can contain one or more XML documents. Each XML document is assigned to a key, similar to the way up to 5 values can be assigned to a key in a static VARA object.

 

Structured documentation tabs

Every object in the AE can have one or more documentation (DOCU) tabs. A documentation tab may contain either unstructured or structured documentation. Unstructured documentation is stored as plain text. Structured documentation is stored as XML.

Screenshot displaying the area in which you drag the node to move it to its final position below the parent node.

(Documentation tabs can be defined in UC_OBJECT_DOCU.)

 

Working with XML

The AE scripting language includes many functions for working with XML. Using these scripting functions, one can extract or manipulate individual parts of the XML. The general approach is:

  1. Open the XML (from a file, a string stored in a variable, an XML VARA, or a structured documentation tab)
  2. Read and/or manipulate the XML.
  3. Close and/or save the XML.

 

Before you can use the Script Elements for XML Elements, you must first get an XML DOM for the XML you wish to work with. Once you have finished working with the XML DOM, you can choose to save the (perhaps modified) XML. The approach you’ll need to use depends on where the source XML resides and what you wish to do with the data afterward.

The attached PowerPoint presentation depicts the options for steps 1 and 3. The first slide is included here.

 

 

An example is is described below.

  1. Use GET_VAR to read part of an XML VARA object into a variable as a string.
  2. Use XML_OPEN with the STRING parameter to open the XML into an XML DOM.
  3. Use the Script Functions for XML Elements to work directly with the XML DOM, optionally making changes. E.g.,
  4. Use XML_TO_STRING to convert the XML DOM back to a string.
  5. Use :XML_CLOSE to close the XML DOM.
  6. Create a new XML VARA by using CREATE_OBJECT and specifying the object type XML*.
  7. Use :PUT_VAR to write the XML string to the new target XML VARA object.

 

* Although this capability is not documented, you can use CREATE_OBJECT to create XML VARAs.

 

See also:

XML_PROCESS_TO_DOM should be able to work with data sequences created by PREP_PROCESS_VAR_XML

How to save changes to XML DOCU tabs? 

XML DOM functions for attributes 

 

If you would like to contribute to this document, please contact one of the authors.

3 people found this helpful

Outcomes