I have a need to save a xml file in a directory …..if it is not well formed.
Just to analyze it for the reason for the failure.
How do i save the xml request in a directory in catch block?
i tried doing it..but the variables created in the try block seems undefined in catch block. I am a newbie…sorry if its a basic question. any solutions?
try {
Create a well formed xml request
open a http connection and post it
}
//catching all exceptions here
catch (Exception e) {
e.printStackTrace();
}
The {} braces are scoping the variables that are inside your try block, so they’re not available outside of that scope. You could do something like this: