当前位置: 技术问答>java相关
请问我在jsp里要读取其它网站上的xml的内容应该如何处理?
来源: 互联网 发布时间:2015-03-17
本文导语: 本地文件可以通过以下程序来实现 SAXParser.parse(xmlFile,Hashtable) 那么远程的呢? | SAXParser: parse public void parse(java.lang.String uri, DefaultHandler dh) throws ...
本地文件可以通过以下程序来实现
SAXParser.parse(xmlFile,Hashtable)
那么远程的呢?
SAXParser.parse(xmlFile,Hashtable)
那么远程的呢?
|
SAXParser:
parse
public void parse(java.lang.String uri,
DefaultHandler dh)
throws SAXException,
java.io.IOException
Parse the content described by the giving Uniform Resource Identifier (URI) as XML using the specified DefaultHandler.
Parameters:
uri - The location of the content to be parsed.
dh - The SAX DefaultHandler to use.
Throws:
java.io.IOException - If any IO errors occur.
java.lang.IllegalArgumentException - If the uri is null.
SAXException - If the underlying parser throws a SAXException while parsing.
See Also:
DocumentHandler
parse
public void parse(java.lang.String uri,
DefaultHandler dh)
throws SAXException,
java.io.IOException
Parse the content described by the giving Uniform Resource Identifier (URI) as XML using the specified DefaultHandler.
Parameters:
uri - The location of the content to be parsed.
dh - The SAX DefaultHandler to use.
Throws:
java.io.IOException - If any IO errors occur.
java.lang.IllegalArgumentException - If the uri is null.
SAXException - If the underlying parser throws a SAXException while parsing.
See Also:
DocumentHandler
|
你可以先保存为FILE,好象还有其它的输入类,有FILE,URL 等等,看看API吧。
|
SAXReader(filename):local or remote.