I’m trying to understand how best to store, read, and modify arbitrary XML in UC4 objects. I see a couple of ways of doing this:
1. XML VARA objects
There are a few scripting commands that can be used to work with XML VARA objects:
GET_VAR
Using GET_VAR, one can retrieve either the whole XML content for a particular VARA key, or use an Xpath query to retrieve just part of the XML.
:PUT_VAR
When using :PUT_VAR, one cannot write or modify just part of the XML. One must replace the whole thing or nothing.
PREP_PROCESS_VAR_XML
Using PREP_PROCESS_VAR_XML, one can create a data sequence based on an XPath query.
2. Structured documentation tabs
The AE scripting language includes many functions for working with structured documentation tabs, including:
Using these scripting functions, one can easily manipulate individual parts of the XML.
The functions for working with structured documentation are quite flexible. Is there any way to get similarly fine-grained control over XML stored in XML VARA objects?
Dear Michael,
I once tried to read an xml file created out of a PDF file. There were a lot of style-attributes in the tags, so my Oracle-Database could not store the original xml-file.
Since I just wanted to get some Table-Data out of that file, I wrote a little bash script to get rid of all unnecessary lines and attributes:
Line 11 cuts out only the lines with data-, cell- or row-tags. This works only, if the data in the file contain no linefeed.
Line 12 cuts out all attributes in the tags.
After cleaning out the file with this script, I was able to load the xml into an XML-VARA.
I do not use that any more though, since I was able to get the original data via csv - this is so much easier and reliable to process!
Regards, Nicole
PS. I forgot the <Table>-tag in the script. I used that, too, for surrounding the rows.
The SAP Application logs are also in XML. Can use the XML commands to parse the application log that is returned in SAP jobs.
Docu: Report types
I recently discovered that it’s possible to use CREATE_OBJECT to create XML VARAs. This makes the following workflow possible:
xml automation engine script ae scripting automation engine ca automic automation engine ca automic workload automation
I thought this approach might also work:
* These script functions are:
Moves an XML element in front of another element
XML_APPEND_CHILD
Adds a new sub-element to an XML element
XML_APPEND_CLONE
Duplicates an XML element and attaches it to another element
XML_APPEND_ELEMENT
Attaches an existing XML element to another element
XML_BEAUTIFY
Beautifies the XML document for legibility
XML_CLONE_AND_RENAME
Duplicates and renames an XML element
:XML_CLOSE
Closes an XML document
XML_DELETE_NODE
Removes a specific XML element
XML_GET_ATTRIBUTE
Retrieves the value of an attribute
XML_GET_CHILD_COUNT
Counts the sub-elements of an element
XML_GET_FIRST_CHILD
Identifies the first sub-element of an element
Identifies the last sub-element of an element
XML_GET_NEXTSIBLING
Identifies the succeeding element
XML_GET_NODE_NAME
Retrieves the name of an element
XML_GET_NODE_TEXT
Retrieves the text of an element
XML_INSERT_BEFORE
Creates a new XML element and inserts the new element in front of another element
XML_OPEN
Opens an XML document for processing
XML_PRINTINTOFILE
Writes the XML document in a file
XML_REMOVE_CHILDREN
Removes all the sub-elements of an XML element
XML_SELECT_NODE
Identifies any element
XML_SET_ATTRIBUTE
Adds a new attribute to an XML element or changes an existing attribute
XML_SET_NODE_TEXT
Changes or sets the value of an XML element
XML_TO_STRING
Returns the XML of a specific element as text
If this is supposed to work, I haven’t figured it out yet. The documentation page for e XML_PROCESS_TO_DOM includes an example using PREP_PROCESS_FILE to create a data sequence from an XML file stored on the file system. However, it does not include an example using PREP_PROCESS_VAR_XML.
Ok, I figured it out. Here is how to use the XML handling functions with an XML VARA:
I discovered a limitation of this approach. At least on my system, the XML_OPEN operation fails if the XML content to be loaded exceeds a certain size.
Both XML VARAs and script variables are supposed to be able to store data of arbitrary length, so this might be a bug.
I reported the ORA-19011 problem with XML_OPEN to CA.
Here’s my guess about what’s going on:
I passed along this information in the ticket. I’ll post an update when I know more.
CA has acknowledged that this is a bug. The fix is currently planned for release in 12.2.2 and 12.3.0. I don't know the KB article number yet, but our case number for this is 01180988.
CA published a new KB article about this:
KB000121626 – XML_OPEN -> 'ORA-19011: Character string buffer too small' with large XML VARA entries
Here’s an excerpt:
The ship date of 12.2.2 has slipped a bit, and I gather 12.3 will also be delayed.
I took what I learned here and incorporated it into a new document:
Working with XML in the Automation Engine