是否保证每个网页HTML上的非数字属性值总是被引用? [英] Is it guaranteed that non-numeric attribute values on every web-page HTML are always quoted?

查看:76
本文介绍了是否保证每个网页HTML上的非数字属性值总是被引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在解析不同网页的源代码。



我不确定它是否保证它始终是HTML格式,但为了这个问题,这是我所感兴趣的一切(即,你可以假设我的问题是指HTML页面)。



现在,我读了XML和XHTML的标准,指出每个属性的值,无论是否为数字,都必须引用(用>封装)。



但是我一直无法在HTML标准中找到这个问题。



如果我没有记错,数字值不一定是引用的。



非数字值如何?我可以假设他们总是被引用吗?



HTML标准不需要引用属性,参见 /TR/html5/syntax.html#elements-attributesrel =nofollow noreferrer> HTML5 - HTML语法 - 属性
$ b


8.1.2.3属性

... <
属性可以用四种不同的方式指定:

空属性语法

未加引号的属性值语法

单引号属性值语法<
双引号属性值语法



I'm parsing the source code of different web pages.

I'm not sure whether or not it is guaranteed that it will always be in HTML format, but for the sake of this question, it is all I'm interested in (i.e., you can assume that my question refers to HTML pages).

Now, I read the standard for XML and XHTML, stating that the value of every attribute, whether it's numeric or not, has to be quoted (encapsulated with ").

But I have not been able to find this issue on the HTML standard.

If I remember correctly, numeric values are not necessarily quoted.

What about non-numeric values? Can I assume that they are always quoted?

Thanks

解决方案

The HTML standard doesn't require attributes to be quoted, see HTML5 - The HTML syntax - Attributes

8.1.2.3 Attributes
...
Attributes can be specified in four different ways:
Empty attribute syntax
Unquoted attribute value syntax
Single-quoted attribute value syntax
Double-quoted attribute value syntax

这篇关于是否保证每个网页HTML上的非数字属性值总是被引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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