XHTML 1.0 Transitive,有没有可以重构HTML的工具?

发布于 2024-09-03 05:06:59 字数 257 浏览 9 评论 0 原文

我有一个使用以下配置设置运行的 Asp.net Web 应用程序。

<xhtmlConformance mode="Legacy"/>

这限制了 AJAX 的使用以及与多个浏览器的兼容性。

如果我的理解是正确的,则需要修复 aspx 页面的 HTML 代码以符合 XHTML 1.0 Transitional。

有很多 HTML 页面,大约 1000 个,有没有一个工具可以加快这个过程?

I have a Asp.net web application running with the following config setting.

<xhtmlConformance mode="Legacy"/>

This limits use of AJAX and compatibility with multiple browser.

If my understanding is correct, the HTML code of the aspx pages need to be fixed to comply with XHTML 1.0 Transitional.

There are alot of HTML pages, ~1000, is there a tool that could speed up this process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你的往事 2024-09-10 05:06:59

DMS 软件重新工程工具包 是一个用于自动对大型源代码进行批量更改的工具基地。

DMS 使用语言精确的解析器来读取源代码,并使用语言精确的分析器来确定含义或问题。可以使用源到源程序转换来进行表单的更改, “如果您看到这个,请将其替换为那个”,用语言表面语法表示。这些模式由语言语法驱动,并应用于 DMS 解析器生成的 AST。

DMS 具有多种语言的语言前端,包括 HMTL 和 XHTML。

DMS 已用于“脏”HTML(即使有精确的定义!)来重构它。它可能非常适合解决您的修复 1000 页问题。

The DMS Software Reengineering Toolkit is a tool for automating mass change to large source code bases.

DMS uses language-precise parsers to read source code, and langauge-precise analyzers to determine meaning or problems. One can use Source to Source program transformations to carry out changes of the form, "if you see this, replace it by that" stated in terms of language surface syntax. The patterns are driven by the language grammar and are applied to ASTs generated by DMS parsers.

DMS has language front ends for a variety of languages, including HMTL and XHTML.

DMS has been used on "dirty" HTML (even that has a precise definition!) to refactor it. It might be a pretty good match for your fix-1000-pages problem.

私野 2024-09-10 05:06:59

当前页面是 HTML 还是 XHTML?如果它们是 HTML 格式,请保留它们。使用 XHTML 没有任何好处。

Are the pages currently in HTML or XHTML? If they are in HTML, leave them. There is no benefit to using XHTML.

月下凄凉 2024-09-10 05:06:59

HTML 5 支持使用 XML 语法,因此从旧版 HTML 迁移到 XHTML 将具有一些长期优势,因为您的页面在语法上将是正确的,这可以在完成后更轻松地迁移到 HTML 5 或 XHTML 2。

正如 大卫所述Dorward 在他的回答中,HTML Tidy 可能有用如果您有相当恒定的 HTML 标记,但考虑到页面数量,如果是这种情况,我会感到惊讶。如果您在 Google 上搜索“旧版 html 到 xhtml 工具" 其他一些可能值得研究的工具。

另一件需要考虑的事情是页面的编写方式。大多数旧版 HTML 页面在标记和样式之间没有明确的区分,因此您可能必须为 CSS 文件提取样式,而自动工具可能会遇到或错过这些样式。因此,您可能会遇到这样一种情况:最好的办法是坐下来访问网站并通过验证器(例如 W3C 标记验证服务或使用浏览器插件在您浏览网站时进行测试。 Firefox 的 Html Validator 非常好,通常就是这样我测试网络应用程序。这样做的缺点是,如果代码隐藏页面中生成了任何 HTML,您在测试期间可能不会遇到它。

HTML 5 supports the use of XML syntax so moving from legacy HTML to XHTML is going to have some long term advantages since you pages will be syntactically correct which could allow for an easier move to HTML 5 or XHTML 2 when they are completed.

As noted by David Dorward in his answer, HTML Tidy might be useful if you have fairly constant HTML markup, but given the number of pages I would be surprised if that was the case. If you do a Google search for "legacy html to xhtml tool" some other tools turnup that might be worth looking into.

Another thing to take into account is how the pages are written. Most legacy HTML pages don't have a clear separation between markup and styles so you are likely going to have to pull styling out for CSS files that automatic tools can be hit or miss with. As such, you might be looking at a situation where the best thing to do is sit down with the site and run the pages though a validator such as the W3C Markup Validation Service or use a browser plug-in to do the testing while you are browsing through the site. The Html Validator for Firefox is pretty good and this is generally how I test web applications. The downside to this that if there is any HTML that is being generated in the code-behind pages, you may not encounter it during testing.

太阳男子 2024-09-10 05:06:59

Tidy 可能是最好的,但我从来没有对它完全满意,如果代码有那么糟糕吗?这通常表明它无论如何都需要重写。

Tidy is probably the best there is, but I've never been entirely happy with it, and if the code is that bad it is usually a sign that it needs rewriting anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文