Ashish Mishra
Ashish Mishra

Reputation: 169

Unzip Microsoft Infopath .xsn file with Java

I am facing one issue which is related to unzipping .xsn file from java code. I am stuck up with and looking for some resolution.

Guys can you please help me out from this problem?

I have tried with java traditional code to ZipFile class.

Upvotes: 0

Views: 318

Answers (2)

Ashish Mishra
Ashish Mishra

Reputation: 169

Below is the answer for my requirement which might be useful to you.

        String command = "expand \"C:\\Users\\amishra\\Desktop\\backup\\BOM.xsn\" \"C:\\Users\\amishra\\Desktop\\backup\" -F:*";            
        Process process = Runtime.getRuntime().exec(command);

        BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
        BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));

        String s;

        while ((s = stdInput.readLine()) != null) {
            System.out.println(s);
        }

        // Read command errors
        System.out.println("Standard error: ");
        while ((s = stdError.readLine()) != null) {
            System.out.println(s);
        }

Upvotes: 2

Mohit
Mohit

Reputation: 1215

The XSN file is really a CAB file. Try checking out the Microsoft CAB SDK here

http://support.microsoft.com/?scid=kb;EN-US;310618

Upvotes: 1

Related Questions