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:
There are a few scripting commands that can be used to work with XML VARA objects:
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.
When using :PUT_VAR, one cannot write or modify just part of the XML. One must replace the whole thing or nothing.
Using PREP_PROCESS_VAR_XML, one can create a data sequence based on an XPath query.
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?
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.
8/23/2018 3:46:50 PM - U00020331 Runtime error in object 'UC0.XML_TEST-1.SCRI', line '00003': U00003590 UCUDB - DB error: 'OCIStmtFetch', 'ERROR ', '', 'ORA-19011: Character string buffer too small'
Both XML VARAs and script variables are supposed to be able to store data of arbitrary length, so this might be a bug.
I recently discovered that it’s possible to use CREATE_OBJECT to create XML VARAs. This makes the following workflow possible:
#xml #automationenginescript #aescripting #automationengine #caautomicautomationengine #caautomicworkloadautomation
I took what I learned here and incorporated it into a new document:
Working with XML in the Automation Engine
I thought this approach might also work:
* These script functions are:
Moves an XML element in front of another element
XML_APPEND_CHILDAdds a new sub-element to an XML element
XML_APPEND_CLONEDuplicates an XML element and attaches it to another element
XML_APPEND_ELEMENTAttaches an existing XML element to another element
XML_BEAUTIFYBeautifies the XML document for legibility
XML_CLONE_AND_RENAMEDuplicates and renames an XML element
:XML_CLOSECloses an XML document
XML_DELETE_NODERemoves a specific XML element
XML_GET_ATTRIBUTERetrieves the value of an attribute
XML_GET_CHILD_COUNTCounts the sub-elements of an element
XML_GET_FIRST_CHILDIdentifies the first sub-element of an element
XML_GET_NEXTSIBLINGIdentifies the succeeding element
XML_GET_NODE_NAMERetrieves the name of an element
XML_GET_NODE_TEXTRetrieves the text of an element
XML_INSERT_BEFORECreates a new XML element and inserts the new element in front of another element
XML_OPENOpens an XML document for processing
XML_PRINTINTOFILEWrites the XML document in a file
XML_REMOVE_CHILDRENRemoves all the sub-elements of an XML element
XML_SELECT_NODEIdentifies any element
XML_SET_ATTRIBUTEAdds a new attribute to an XML element or changes an existing attribute
XML_SET_NODE_TEXTChanges or sets the value of an XML element
XML_TO_STRINGReturns 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:
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 reported the ORA-19011 problem with XML_OPEN to CA.
Here’s my guess about what’s going on:
1. XML VARA information is stored in the OVW table in column OVW_ValueX. The data are stored as CLOBs in Oracle.2. The AE’s XML_OPEN function uses SQL that implicitly or explicitly converts the CLOB to VARCHAR2.3. The error occurs when the size of the CLOB exceeds 4000 characters (the maximum size of VARCHAR2).
1. XML VARA information is stored in the OVW table in column OVW_ValueX. The data are stored as CLOBs in Oracle.
2. The AE’s XML_OPEN function uses SQL that implicitly or explicitly converts the CLOB to VARCHAR2.
3. The error occurs when the size of the CLOB exceeds 4000 characters (the maximum size of VARCHAR2).
I passed along this information in the ticket. I’ll post an update when I know more.
2020-09-17 14:33:21 SOAP Response
2020-09-17 14:33:21 Response-Code: 200
2020-09-17 14:33:21 Content-Type: text/xml;charset=utf-8
2020-09-17 14:33:21 Transfer-Encoding: chunked
2020-09-17 14:33:21 Date: Thu, 17 Sep 2020 21:33:20 GMT
2020-09-17 14:33:21 Set-Cookie: 96b6db70e130181d48cd95ed13fde9aa=110fd272f386476842dbd7d1853be6d1; path=/; HttpOnly; Secure
2020-09-17 14:33:21 Payload: <tns:Envelope xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/">
2020-09-17 14:33:21 <tns:Header>
2020-09-17 14:33:21 <gwsoap:traceability_id xmlns:gwsoap="http://guidewire.com/ws/soapheaders">?</gwsoap:traceability_id>
2020-09-17 14:33:21 </tns:Header>
2020-09-17 14:33:21 <tns:Body>
2020-09-17 14:33:21 <startBatchProcessResponse xmlns="http://guidewire.com/ab/ws/gw/webservice/ab/ab1000/MaintenanceToolsAPI">
2020-09-17 14:33:21 <return xmlns:pogo="http://guidewire.com/gw/api/tools">
2020-09-17 14:33:21 <pogo:Pid>173532</pogo:Pid>
2020-09-17 14:33:21 </return>
2020-09-17 14:33:21 </startBatchProcessResponse>
2020-09-17 14:33:21 </tns:Body>
2020-09-17 14:33:21 </tns:Envelope>
2020-09-17 14:33:21 --------------------------------------
2020-09-17 14:33:21 Starting XQuery response script execution.
2020-09-17 14:33:21 Response script execution done.
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:
#!/bin/bashset -xif [ "$1" != '' ]; then PDatei=$1else # Parameter fehlt echo "Parameter fehlt: Dateiname der zu vereinfachenden xml-Datei (ohne .xml)" && exit 1fiegrep -i "<Data|<Cell|<Row|</Data|</Cell|</Row" $PDatei.xml > $PDatei-1.xml || exit 2sed 's/<\([A-Za-z]*\) [^\/>]*\(\/>\|>\)/<\1\2/g' $PDatei-1.xml > $PDatei-erg.xml || exit 3
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!
PS. I forgot the <Table>-tag in the script. I used that, too, for surrounding the rows.
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:
This is a bug which shall be corrected in the following releases:AE 12.2.2 scheduled for 11.02.2019 AE 12.3.0 scheduled for 28.02.2019
This is a bug which shall be corrected in the following releases:
The ship date of 12.2.2 has slipped a bit, and I gather 12.3 will also be delayed.