import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class Exec {
public static void main(String args[]) {
FileOutputStream fos;
URL url;
URLConnection urlConnection;
InputStream is;
int i;
try {
fos = new FileOutputStream("results.xml");
url = new URL(
"http://localhost:8080/exist/servlet/db/?_query=for $p in //stu where contains($p,'exam') return $p");
urlConnection = url.openConnection();
is = urlConnection.getInputStream();
i = is.read();
while (i > 0) {
fos.write(i);
i = is.read();
}
fos.close();
is.close();
} catch (IOException e) {
}
}
}
[此贴子已经被作者于2010-12-14 09:41:55编辑过]