我需要阅读小文件(最多几MB,UTF-8编码的)XML文件,翻看各种元素和属性,或许修改一些,然后再将XML写回到磁盘(最好使用漂亮的缩进格式) 。
什么是最适合我需求的XML解析器?有很多选择。有些我知道的是:
JDOM
Woodstox
XOM
DOM4J
VTD-XML
的Xerces-J
赤红
当然也是JDK中的一个(我正在使用Java 6)。我熟悉Xerces,但发现它笨重。
有什么建议吗?
它们的区别,我看到的有如下几点:
1.curl是libcurl这个库支持的,wget是一个纯粹的命令行命令。
2.curl支持更多的协议。curl supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMTP and RTSP at the time of this writing. Wget supports HTTP, HTTPS and FTP.
3.curl 默认支持HTTP1.1(也支持1.0),而wget仅仅支持HTTP1.0规范。引用wget的man page中的一段话吧,Please be aware that Wget needs to know the size of the POST data in advance. It's not quite clear how to work around this limitation inherent in HTTP/1.0. Although HTTP/1.1 introduces chunked transfer that doesn't require knowing the request length in advance, a client can't use chunked unless it knows it's talking to an HTTP/1.1 server. And it can't know that until it receives a response, which in turn requires the request to have been completed -- a chicken-and-egg problem.
4.curl在指定要下载的链接时能够支持URL的序列或集合,而wget则不能这样;
5.wget支持递归下载,而curl则没有这个功能。(这是wget的一个主要好处,wget也是有优势的,呵呵)