java怎么获取远程带参数的xml文件?
java怎么获取远程带参数的xml文件?
类似地址:
http://192.168.1.100/test.jsp?cindex=2&pagesize=2
如果没有带有参数的地址:像
http://192.168.1.100/test.xml就能获取。
楼上厉害。。
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class roXML {
public static void main(String[] args) {
try {
String url = "http://board2.finance.daum.net/gaia/do/xml/finance/read?bbsId=stock&articleId=1673473&pageIndex=1&viewObj=1:2:0";
URLConnection uc = new URL(url).openConnection();
uc.setConnectTimeout(10000);
uc.setDoOutput(true);
InputStream in = new BufferedInputStream(uc.getInputStream());
Reader rd = new InputStreamReader(in,"UTF-8");
StringBuffer temp = new StringBuffer();
String strHtml = null;
int c = 0;
while ((c = rd.read()) != -1) {
temp.append((char) c);
}
in.close();
strHtml = temp.toString();
} catch (MalformedURLException e) {
// TODO Auto-generated catch bloc
相关问答:
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式文件
<folder state="unchecked" label="全部">
<folder state="unchecked" isBra ......
我有一个类似的xml的 string,想通过遍历怎么个xml 输出我想要的element的值
xml 为:
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......
现在有个xml文件是<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......