XmlParser and XmlSlurper use deprecated libraries by default.

Version: KS 9.7.4

*Summary
When using the default XmlSlurper or XmlParser, a deprecated library is used.

The default library that Katalon is using is groovy.util…Groovy has updated this library to groovy.xml.

So, when using the XmlSlurper or XmlParser, Katalon is using .util and not the updated .xml library by default.

*Steps to reproduce

  1. Create a new test case,
  2. Enter the line ‘def xml = new XmlParser()’ or 'def xml = new XmlSlurper(),
  3. Observe that both classes are deprecated.

*Expected Results

  • Katalon utilizes current libraries

*Actual Results

  • Katalon is utilizing a deprecated library

*Screenshots / Videos


Version: KS 9.7.4

1 Like

I don’t understand what you mean above.


As described in the Groovy’s official document, the below imports are implicitly added by the Groovy language for you:

import java.lang.*
import java.util.*
import java.io.*
import java.net.*
import groovy.lang.*
import groovy.util.*
import java.math.BigInteger
import java.math.BigDecimal

In Groovy v2.x, the groovy.util.XmlParser was automatically imported as it was included in the default imports as above. Therefore you did not have to write import groovy.util.XmlParser explicitly.

When Katalon Studio was upgraded from v8.x to v9.0, they upgraded the bundled Groovy from v2 to v3. When Groovy upgraded from v2 to v3, the groovy.util.XmlParser was moved to groovy.xml.XmlParser.

In Groovy v3.x and newer, there is a class groovy.xml.XmlParser but the default imports do not include the class. Thefore you are required to write import groovy.xml.XmlParser explicitly.

Concerning this issue, Katalon has no problem, I believe.

1 Like