关于 html5 dtd/schema 的另一个问题

发布于 2024-09-29 19:02:44 字数 454 浏览 3 评论 0原文

如果没有DTD或模式来验证H5文档,我们应该如何进行文档验证?通过文档验证,我的意思是“我们如何确保我们的 html5 文档在语法上准确且结构健全?”请帮忙!如果我们无法准确验证 HTML5 文档,这将成为我们行业的一个巨大问题!

当然,W3C 有一个在线工具可以验证各个页面。但是,如果我正在创建很多页面(例如数百个页面)并且我想以某种批处理模式验证它们,那么确保有效结构和语法的公认方法是什么?我的意思是,仅仅查看文档并说“是的。这是一个有效的 xml 文档”似乎相当初级。自定义标签怎么样?标签属性呢? W3C 似乎让我们有点被冷落了。

也许最好的答案可以在 HTML 编辑器中找到。但随后您会得到 DTD/模式碎片。每个编辑器供应商都对有效结构提出了自己的解释。

或许答案是“等待HTML5正式发布”。但我真的等不及了。我现在需要开始创建和验证内容。我想要发布只能使用 html5 来完成的应用程序。

那么,有什么想法吗?

If there is no DTD or schema to validate the H5 document against, how are we supposed to do document validation? And by document validation, I mean "how are we supposed to ensure our html5 documents are both syntactically accurate and structurally sound?" Please help! This is going to become a huge problem for our industry if we have no way to accurately validate HTML5 documents!

Sure, the W3C has an online tool that validates individual pages. But, if I'm creating A LOT of pages (hundreds, say) and I want to validate them in a sort of batch mode, what is the accepted method of ensuring valid structure and syntax? I mean, it seems rather rudimentary to just look at the document and say "yep. that's a valid xml document." What about custom tags? What about tag attributes? It seems like the W3C is leaving us out in the cold a little bit here.

Maybe the best answer will be found in the HTML editor. But then you get DTD/schema fragmentation. Each editor vendor coming up with their own rendition of what a valid structure is.

Maybe the answer is "wait for HTML5 to become official". But I really can't wait for that. I need to start creating and validating content now. I have applications I want to publish that can only be accomplished with html5.

So, any thoughts?

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

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

发布评论

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

评论(5

多彩岁月 2024-10-06 19:02:44

如果没有DTD或模式来验证H5文档,我们应该如何进行文档验证?

使用专门的 HTML5 验证器,而不是通用的 SGML 或 XML 验证器。

显然,由于规范仍处于草案形式,现有的工具还不成熟,很可能已经过时或变得过时。

当然,W3C 有一个在线工具可以验证各个页面。但是,如果我创建大量页面(例如数百个)并且我想以某种批处理模式验证它们,那么确保有效结构和语法的公认方法是什么?

使用不同的工具或下载 W3C 验证器并运行本地副本。它有一个 SOAP API,因此编写批量验证工具并不困难。

自定义标签怎么样?

HTML5 不允许自定义元素。

标签属性怎么样?

HTML5 中唯一的自定义属性是 data-* 属性,因此 HTML 5 验证器可以识别它们。

W3C 似乎让我们有点被冷落了。

您似乎期望 HTML 5(未完成)的 QA 工具的状态能够达到与 HTML 4(已有十多年历史)相同的标准。这不是一个现实的期望。

也许最好的答案可以在 HTML 编辑器中找到。但随后您会得到 DTD/模式碎片。每个编辑器供应商都对有效结构提出了自己的解释。

即使没有以 DTD 或模式的形式表达,规范也是清晰的(尽管在不断变化)。如果每个编辑对什么是有效的有不同的想法,那么大多数或全部都将要么过时,要么只是有缺陷。

也许答案是“等待 HTML5 正式发布”。但我真的等不及了。我现在需要开始创建和验证内容。我想要发布只能使用 html5 才能完成的应用程序。

如果你需要生活在最前沿,那么你就必须接受这样做的局限性和风险。

If there is no DTD or schema to validate the H5 document against, how are we supposed to do document validation?

With a specialized HTML5 validator rather then a generic SGML or XML validator.

Obviously, as the specification is still in draft form, the tools that do exist are immature and likely to be out of date or become out of date.

Sure, the W3C has an online tool that validates individual pages. But, if I'm creating A LOT of pages (hundreds, say) and I want to validate them in a sort of batch mode, what is the accepted method of ensuring valid structure and syntax?

Either use a different tool or download the W3C validator and run a local copy. It has a SOAP API so writing a batch validation tool isn't difficult.

What about custom tags?

HTML5 doesn't allow custom elements.

What about tag attributes?

The only custom attributes in HTML5 are data-* attributes, so an HTML 5 validator can recognize them.

It seems like the W3C is leaving us out in the cold a little bit here.

It seems like you expect the state of QA tools for HTML 5 (unfinished) to be up to the same standard as those for HTML 4 (over a decade old). This isn't a realistic expectation.

Maybe the best answer will be found in the HTML editor. But then you get DTD/schema fragmentation. Each editor vendor coming up with their own rendition of what a valid structure is.

The specification is clear (although in flux) even if it isn't expressed in the form of a DTD or schema. If each editor has a different idea of what is valid, then most or all of them are going to be either out of date or just buggy.

Maybe the answer is "wait for HTML5 to become official". But I really can't wait for that. I need to start creating and validating content now. I have applications I want to publish that can only be accomplished with html5.

If you need to live in the bleeding edge, then you have to accept the limitations and risks of doing so.

最偏执的依靠 2024-10-06 19:02:44

您可能会发现这个问题/答案很有趣:HTML 5 验证值得吗蜡烛?。答案是由 http://about.validator.nu/ 的开发人员编写的。

You might find this question/answer interesting: Will HTML 5 validation be worth the candle? . The answer is written by the developer of http://about.validator.nu/ .

叹梦 2024-10-06 19:02:44

您应该首先查看 http://about.validator.nu/

您的一些担忧(尽管不是全部)在那里得到了解决。您可以托管自己的验证器,有一个基于 python 的提交脚本,您可以使用 RESTFUL Web 服务 API,并且有多种方法可以获取各种不同形式的验证输出。

然而,我看不到一种将 XHTML5 与其他 XML 应用程序集成的简单方法,以便可以轻松地创建此类复合文档的验证器。不过,早期版本的 XHTML 也确实没有办法做到这一点。

You should start by taking a look at http://about.validator.nu/ .

Some, though not all, of your concerns are addressed there. You can host your own validator, there's a python based submission script, you can use a RESTFUL web service API and there are ways to get validation output in a variety of different forms.

I can't however see a simple way to integrate XHTML5 with other applications of XML such that one can easily create a validator of such compound documents. Not that there's really been a way to do that with earlier versions of XHTML either though.

夜声 2024-10-06 19:02:44

效果很好: https://github.com/hober/html5-el

这对我来说 为了使其正常工作,我重命名了默认的“/etc/schema/schemas.xml”文件,以便将其移开并让“html5-el”文件由 nxml-mode 使用。

This is working well for me: https://github.com/hober/html5-el

To get this to work, I renamed the default '/etc/schema/schemas.xml' file in order to move it out of the way and let the 'html5-el' one be used by nxml-mode.

眼波传意 2024-10-06 19:02:44

如果没有DTD或模式来验证H5文档,我们应该如何进行文档验证?通过文档验证,我的意思是“我们如何确保我们的 html5 文档在语法上准确且结构健全?”请帮忙!如果我们无法准确验证 HTML5 文档,这将成为我们行业的一个巨大问题!

如果使用 Firefox 或 Opera 测试页面,这两者都会报告错误,例如代码不“格式良好”和标签不匹配。除此之外,validator.w3.org 或 validator.nu 等验证器之一肯定会有所帮助。

当然,W3C 有一个在线工具可以验证各个页面。但是,如果我正在创建很多页面(例如数百个页面)并且我想以某种批处理模式验证它们,那么确保有效结构和语法的公认方法是什么?我的意思是,仅仅查看文档并说“是的,这是一个有效的 xml 文档”似乎相当初级。

有多种方法可以以批处理模式运行 W3C 验证器。

自定义标签怎么样?标签属性呢? W3C 似乎让我们有点被冷落了。

对此问题的简单答案是“自定义标签”根本无效被视为有效。工作组彻底解决了“分布式可扩展性”问题,特别是允许“去中心化”
各方创建自己的语言”和“扩展属性”(http://lists.w3.org/Archives/Public/public-html/2011Feb/0085.html)。扩展 HTML 的方法有很多种(http:// www.whatwg.org/specs/web-apps/current-work/multipage/infrastruct.html#extensibility),但添加自定义标签不是其中之一。自定义数据和微数据属性应该可以很好地验证。

也许答案是“等待 HTML5 正式发布”。但我真的等不及了。我现在需要开始创建和验证内容。我想要发布只能使用 html5 才能完成的应用程序。

由于 HTML 5 已于去年年底(2010 年 12 月)稳定下来,在我看来,我们不需要等待它成为 W3C 的正式“推荐”。稳定的规范提供了一个坚实的基础,所有浏览器供应商都可以一致地实施该规范,并为该规范超越 HTML 5 的持续发展奠定了坚实的基础,该规范现在被称为“HTML Living Standard”(2011 年 1 月及以后) )。 http://www 有一个很好的图表.HTML-5.com/html-versions-and-history.html#html-versions(向下滚动查看图表)。

If there is no DTD or schema to validate the H5 document against, how are we supposed to do document validation? And by document validation, I mean "how are we supposed to ensure our html5 documents are both syntactically accurate and structurally sound?" Please help! This is going to become a huge problem for our industry if we have no way to accurately validate HTML5 documents!

If testing pages with either Firefox or Opera, both of those will report errors such as code that is not "well-formed" and mismatched tags. Beyond that, one of the validators such as validator.w3.org or validator.nu will definitely help.

Sure, the W3C has an online tool that validates individual pages. But, if I'm creating A LOT of pages (hundreds, say) and I want to validate them in a sort of batch mode, what is the accepted method of ensuring valid structure and syntax? I mean, it seems rather rudimentary to just look at the document and say "yep. that's a valid xml document."

There are ways to run the W3C validator in batch mode.

What about custom tags? What about tag attributes? It seems like the W3C is leaving us out in the cold a little bit here.

The easy answer to that one is that "custom tags" are simply not considered valid. The Working Group has thoroughly addressed the issue of "distributed extensibility", particularly with respect to allowing "decentralized
parties to create their own languages" and "extension attributes" (http:// lists.w3.org/Archives/Public/public-html/2011Feb/0085.html). There are numerous ways to extend HTML (http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#extensibility) but adding custom tags is not one of them. Custom data and microdata attributes should validate fine.

Maybe the answer is "wait for HTML5 to become official". But I really can't wait for that. I need to start creating and validating content now. I have applications I want to publish that can only be accomplished with html5.

Since HTML 5 was stabilized at the end of last year (Dec. 2010), IMO we don't need to wait for it to become an official "recommendation" by the W3C. The stabilized spec provides a solid base that all browser vendors can implement consistently and for the ongoing evolution beyond HTML 5 of the spec, which is now being called the "HTML Living Standard" (Jan. 2011 and later). There is a good diagram of this at http://www.HTML-5.com/html-versions-and-history.html#html-versions (scroll down to see the diagram).

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