Posts

Showing posts from October, 2016

How to convert compressed XML image file to a readable(decompressed) XML file

Yesterday at office our team came across a new problem, there were some changes made by the development team, they passed the data to one of the engine and we had to validate that data. The data was populating in compressed non readable format. So our job was to take that data, convert it to readable XML format and validate using XPaths. Due to privacy issues i cannot share the data and the way we validated that data, but here you will find how to decompress that data in readable XML format. Heres the code to convert compressed XML image file to a readable (deompressed) XML file package sorting; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.zip.GZIPInputStream; import javax.xml.bind.DatatypeConverter; public class Decompression