Service Virtualization

Expand all | Collapse all

Read multiple xmls from text file

Jump to Best Answer
  • 1.  Read multiple xmls from text file

    Posted 05-02-2018 03:45 PM
      |   view attached



    I have one attached data file (I can open this in notepad, notepad++). It contains many xmls and my requirement is to push those xmls into MQ. I am looking some step which can do in tool.


    We have read data from Excel or CSV and I can push into MQ. But my data is in .txt file.


    I tried to use “Read a File (Disk,URL or classpath)” and then tried to use “Write to a Delimited file” but its not writing proper data.


    Any suggestion which I can use here.




    zip   13K 1 version

  • 2.  Re: Read multiple xmls from text file
    Best Answer

    Posted 05-03-2018 10:30 AM

    I think you would need the JavaScript Step to manipulate the file. You can split the contents by "<?xml version="1.0"?>". This should give you all the xmls. 

  • 3.  Re: Read multiple xmls from text file

    Posted 05-04-2018 02:41 AM

    Adding to what Tushar has suggested, you can also have a scripted assertion and you can trim the text file in multiple strings (using <?xml version="1.0"?> as delimiter) & save all the XMLs(extracted from the .txt file) in separate property variables.


    Hope this helps.