AnsweredAssumed Answered

V12.1: XPath support - GET_VAR vs. XML_SELECT_NODE and missing features.

Question asked by joel_wiesmann_automic on Mar 1, 2018

Hi all

I've been playing around with the XML_* functions and the XML VARA. GET_VAR (+ PREP_PROCESS_VAR_XML) has been brought to the new level by supporting XPath / XQuery toaccess/read elements

Now obviously if I read from data from a source I can modify (VARA XML), I would also like to change it. Now for me it seems that the common XML_* functions seem not to support XPath :-(.

Also I used EXPORT / IMPORT and wanted to modify the export XML using AE script functions. This is unnecessarily complex without the XPath support for the XML_SELECT_NODE. I also realized, that XML_PRINTINTOFILE does create files that do not start with a <?xml...> encoding information - which prevents to IMPORT the file.

i.E. the below code would - in theory - change the title of the current object:

:SET &EXPORTFILE# = '/tmp/data.xml'


! For simple, one-object-per-file changes possible, but not powerful without XPath.
:SET &XML_RC#          = XML_SET_NODE_TEXT(&XML_NODE#, 'This is my new title.')

! This won't work because of missing <?xml.. encoding information

Is anyone at all using the XML_* functions to mutate export-XMLs or XML VARAs? With all the JSON hype going on I wonder whether XML will survive at all.