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.
(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:
- Open the XML (from a file, a string stored in a variable, an XML VARA, or a structured documentation tab)
- Read and/or manipulate the XML.
- 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.
- Use GET_VAR to read part of an XML VARA object into a variable as a string.
- Use XML_OPEN with the STRING parameter to open the XML into an XML DOM.
- Use the Script Functions for XML Elements to work directly with the XML DOM, optionally making changes. E.g.,
- Use XML_TO_STRING to convert the XML DOM back to a string.
- Use :XML_CLOSE to close the XML DOM.
- Create a new XML VARA by using CREATE_OBJECT and specifying the object type XML*.
- 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.
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.