在linux下将html格式转换成xml格式

Linux下使用tidy转换HTML到XML
通过下载tidy工具并安装,在Linux环境中可以使用tidy命令将HTML文件转换为XHTML。安装过程包括解压、配置、编译和安装。转换操作如:tidy -asxhtml -numeric <index.html> index.xml,反之则用tidy -ashtml -numeric <index.xml> index.html。遇到tidy库加载错误时,可能需要检查系统库文件。
 今天在linux下想将html格式的文件转换成xml格式,便安装了HTML Tidy,但总是不成功,后来看到一篇文章,在

http://anduin.linuxfromscratch.org/files/BLFS/sources/tidy-cvs_20070326.tar.bz2下载了tidy。然后用ssh传到linux下。

bzip2 -d tidy-cvs_20070326.tar.bz2

tar -xvf tidy-cvs_20070326.tar

cd tidy-cvs_20070326

./configure --prefix=/usr/local

make

make install

make clean

便安装成功了。

执行 tidy -asxhtml -numeric <index.html> index.xml

便可转换成功。html格式转成xhtml。也可反之:tidy -ashtml -numeric <index.xml> index.html
应该也有html tidy windows版本的,没有研究。

在网上搜了另外一套在linux下安装的方法,没有尝试,先贴过来。

epf:/home/user # tidy -v
tidy: error while loading shared libraries: libtidy-0.99.so.0: cannot open shared object file: No such file or directory

Because this wasn't' successful I tried to install an rpm I found on rpmfind.net:ftp://fr.rpmfind.net/linux/SuSE-Linux/i386/9.3/suse/src/tidy-020428-277.src.rpm

I tried to install using YaST: yast -i tidy-020428-277.src.rpm

yast runs this command without errors or messages, nothing seems to happen.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值