ItP_1
10 years agoOccasional Contributor
[Res] How to Read multiple XML files from a folder location
Hi,
I am facing a problem in reading multiple XML files within a folder using groovy scripting. I am able to read one file and make use of the contents of the file, but I am unable to read other files which are located in the folder.
Example:
I have 4 XML files (sample1.xml, sample2.xml, sample3.xml, sample4.xml) in a folder "Data". The 'Data' folder is located exactly where the soapui project is stored.
I am able to read sample1.xml using the below piece of code. And I also want to read the other 3 XML files sample 2.xml, sample3.xml, sample4.xml as well. Please help me achieve this.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def projectPath = groovyUtils.projectPath //gets the path of the project root
def response = new File(projectPath, "/Data/sample1.xml").text;
log.info response
Thanks,
UMG ItP
I am facing a problem in reading multiple XML files within a folder using groovy scripting. I am able to read one file and make use of the contents of the file, but I am unable to read other files which are located in the folder.
Example:
I have 4 XML files (sample1.xml, sample2.xml, sample3.xml, sample4.xml) in a folder "Data". The 'Data' folder is located exactly where the soapui project is stored.
I am able to read sample1.xml using the below piece of code. And I also want to read the other 3 XML files sample 2.xml, sample3.xml, sample4.xml as well. Please help me achieve this.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def projectPath = groovyUtils.projectPath //gets the path of the project root
def response = new File(projectPath, "/Data/sample1.xml").text;
log.info response
Thanks,
UMG ItP