Java Programming - Robust method on getting the xml content
i've written a program to download the xml content from the website and use the xslt transformation to filter out the information i need. when i'm testing my program, i get an error in reading the xml file due to downloading of big size of xml. so i'm looking for other robust method to get xml content, any methods recommend ?
here is my current method, i need another method to replace the content in '/* */' :
public class FileDownload {
public static void download(String address, String localFileName){
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
StringBuffer xmlContentBuffer = new StringBuffer();
String temp = new String();
String xmlContent;
Public Object getContent(URLConnection u)
try {
/*
URL url = new URL(address);
out = new BufferedOutputStream(
new FileOutputStream(localFileName));
conn = url.openConnection();
in = conn.getInputStream();
byte[] buffer = new byte[1024];
int numRead;
long numWritten = 0;
System.out.println (in.toString ());
while ((numRead = in.read(buffer)) != -1) {
out.write(buffer, 0, numRead);
numWritten += numRead;
temp = new String(buffer);
xmlContentBuffer.append(temp);
Thread.sleep(50);
}
System.out.println(localFileName + "\t" + numWritten);
xmlContent = xmlContentBuffer.toString();
*/
FileInputStream xslt2= new FileInputStream ("test.xml");
int x2= xslt2.available();
byte b2[]= new byte[x2];
xslt2.read(b2);
xmlContent = new String(b2);

