Skip to main content
rameshp575128
September 14, 2023
Question

Read XML code from ZIP file

  • September 14, 2023
  • 4 replies
  • 0 views

I have a use use case, when any developer uploads their package in one interface  and that should go through the XML code and return if any objects in that package are using any deprecated functions.

To achieve that , is there any function that would read the XML file

    4 replies

    stefanhelzle0001
    Brainy
    September 14, 2023

    I suggest to have a look at the xPath functions.

    https://docs.appian.com/suite/help/23.3/fnc_scripting_xpathdocument.html

    And there is a plugin to unzip files.

    rameshp575128
    September 14, 2023

    Hi Stefan,
    Thanks for it.
    I am finding difficulty in using xpathdocument() I am passing the XML file of object as docId but I was struck at expression and prefix.

    I tried giving the <definition> in the expression but its throwing the following error.
    Expression evaluation error at function a!forEach [line 6]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'xpathdocument' [line 8]: An error occurred while trying to evaluate the XPath expression (<definition>).

    a!localVariables(
      local!allObjectsXMLcode: getdocumentsfromfolder(
        rootFolder: 372884,
        recursiveSearch: false()
      ),
      a!forEach(
        items: local!allObjectsXMLcode[1],
        expression: xpathdocument(
          docId: fv!item,
          expression: ""
        )
      )
    )

    stefanhelzle0001
    Brainy
    September 14, 2023

    Well, I have my doubts that "<definition>" is a valid xPath expression. I suggest to spend some time to learn xPath and start with some simple examples.