将 HTML 转换为 XML [英] Converting HTML to XML

查看:44
本文介绍了将 HTML 转换为 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有成百上千的 HTML 文件需要在 XML 中进行转换.我们使用这些 HTML 为应用程序提供内容,但现在我们必须将这些内容作为 XML 提供.

I have got hundereds of HTML files that need to be conveted in XML. We are using these HTML to serve contents for applications but now we have to serve these contents as XML.

HTML 文件是包含、表格、div、图像、p、b 或强标签等.

HTML files are contains, tables, div's, image's, p's, b or strong tags, etc..

我用谷歌搜索并找到了一些应用程序,但我还没有实现.

I googled and found some applications but i couldn't achive yet.

您能否提出一种将这些文件内容转换为 XML 的方法?

Could you suggest a way to convert these file contents to XML?

推荐答案

我成功地使用了 tidy 命令行实用程序.在 linux 上,我使用 apt-get install tidy 快速安装了它.然后命令:

I was successful using tidy command line utility. On linux I installed it quickly with apt-get install tidy. Then the command:

tidy -q -asxml --numeric-entities yes source.html >file.xml

给出了一个 xml 文件,我可以用 xslt 处理器处理它.但是我需要正确设置 xhtml1 dtds.

gave an xml file, which I was able to process with xslt processor. However I needed to set up xhtml1 dtds correctly.

这是他们的主页:html-tidy.org(以及旧版:HTML 整理)

This is their homepage: html-tidy.org (and the legacy one: HTML Tidy)

这篇关于将 HTML 转换为 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆