2关于验证的问题 [英] 2 Questions about validations

查看:50
本文介绍了2关于验证的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



发布到:alt.html和comp.infosystems。 www。 authoring.html

followup-to:comp.infosystems。 www .authoring.html


大家好,


我有2个关于验证的问题。


1-什么是基本区别

- 验证,有效性

- 格式良好

- 符合条件的文件


基本上,我认为一个格式良好的文件可能不是有效的,但有效的文件必须是格式良好的。一个有效的文件可能

不符合要求,但一致的文件必须是有效的文件。

至少,这是我的想法。我错了吗?你知道一个

文件解开,很好地区分这3个概念吗?


2-创建输入或选择或复选框时,必须将这些插入到

a< form>元件。现在,如果表单不会将任何数据发送到

服务器,那么我只需将action属性分配给空字符串,例如

这个:


< form action ="">


现在,W3C认为这是严格的HTML 4.01中的有效标记代码。

但HTML Tidy警告这是错误的或可能是错误的。什么是

当表单不向任何

服务器发送任何数据时,最好的办法是什么?那么我应该如何指定action属性以便

符合验证要求?


感谢您的帮助,

$ b $bGérard

-

删除等等给我发电子邮件


发布到:alt.html和comp.infosystems 。 www.authoring.html

followup-to:comp。 infosystems。 www.authoring.html


posted to: alt.html and comp.infosystems.www.authoring.html
followup-to: comp.infosystems.www.authoring.html

Hello all,

I have 2 questions about validations.

1- What''s basically the difference between
- validation, validity
- well-formedness
- conformant document

Basically, what I believe is that a well-formed document might not be
valid but a valid document must be well-formed. A valid document might
not be a conformant one but a conformant document must be a valid one.
At least, this is what I think. Am I wrong here? Do you know of a
document that untangles, distinguish well these 3 concepts?

2- When creating inputs or select or checkbox, one must nest these into
a <form> element. Now, if the form is not going to send any data to a
server, then I just assign the action attribute to an empty string like
this:

<form action="">

Now, the W3C considers this as valid markup code in strict HTML 4.01.
But HTML Tidy warns that this is wrong or possibly wrong. What would be
the best thing to do when a form is not going to send any data to any
server? How then should I specify the action attribute in order to
comply with validation requirements?

Thank you for your assistance,

Gérard
--
remove blah to email me

posted to: alt.html and comp.infosystems.www.authoring.html
followup-to: comp.infosystems.www.authoring.html

推荐答案

在文章< 3o ************ @ uni-berlin.de>,
$ b $bGérardTalbot< ne **** *******@gtalbot.org>写道:
In article <3o************@uni-berlin.de>,
Gérard Talbot <ne***********@gtalbot.org> wrote:
张贴到:alt.html和comp.infosystems。 www.authoring.html
followup-to:comp.infosystems。 www。 authoring.html
< form action ="">

现在,W3C认为这是严格的HTML 4.01中的有效标记代码。
但是HTML Tidy警告说这是错误的或可能是错误的。当表单不向任何服务器发送任何数据时,最好的做法是什么?那么我应该如何指定action属性以符合验证要求?
posted to: alt.html and comp.infosystems.www.authoring.html
followup-to: comp.infosystems.www.authoring.html <form action="">

Now, the W3C considers this as valid markup code in strict HTML 4.01.
But HTML Tidy warns that this is wrong or possibly wrong. What would be
the best thing to do when a form is not going to send any data to any
server? How then should I specify the action attribute in order to
comply with validation requirements?




但为什么要创建一个不需要的表单行动?什么

将被使用?


leo


-

< ; http://web0.greatbasin.net/~leo/


GérardTalbot写道:
Gérard Talbot wrote:
1-
基本上有什么区别 - 验证,有效性


在SGML和XML中,有效性意味着文档符合它声明要使用的Document

类型定义(DTD)。验证是一个检查有效性的过程




有效性有时被描述为语法正确性。但是,它不是那么简单。通常有一些规则在

性质上是明显的语法,但不能在DTD中表达,或者只是在DTD中没有表达

。例如,在HTML中,像accesskey =Hello!这样的属性。 (在
中,一个可能具有accesskey属性的元素)是有效的,但

在语法上是不正确的。语法说该值必须是单个

字符,但这个限制不是(并且不能)表示在

DTD中。
。一个松散的词,基本上只是意味着

good (按照某人的口味),除了使用有效性之外。在客观性和准确性方面做出了虚假的索赔。此外,在某些其他区域比HTML更实用,但与HTML实用相关,有效性或者验证

是一个技术术语,其含义与SGML

或XML有效性非常相似,可以使人们感到困惑。例如,W3C创造了

术语有效。样式表。


这可能是设计

SGML中的许多不幸事件之一,将技术含义分配给有效一词;。但是在那个

的时候,通常会选择正常的英语单词,然后给它分配一个非常非常特别限制的技术含义 - 或者

有时会为它指定一个完全随意的含义,相当于以前任何正常使用单词的b $ b。幸运的是这样的事情

在这个勇敢的新世界里不再发生。 :-)

- 格式良好


这是XML& Co中的一个愚蠢的伪概念。 格式良好的XML文档


- 符合文件


那是符合某些标准或规范的文件。

编写良好的标准或规范包含一致性部分

并准确说明符合性所需的内容。请注意,这个

可能并不意味着该文档服从

规范中提出的所有建议;规范可能会选择提出甚至强大的建议,但要求它们不符合一致性要求。对于

示例,对于XHTML文档,根据XHTML规范,强烈建议使用XML

声明(<?xml ...>),但不需要

一致性。

基本上,我认为格式良好的文档可能无效,但有效文档必须格式正确。


是的。这当然与XML有关。一个XML文档甚至可能没有DTD的
。声明有效文件必须格式良好。真的意味着

只是一个事实,只有XML文档可以是一个XML文档

满足一些特殊规则。在实际方面,声明

并不是那么毫无意义:在验证有效性时,我们不能假定该文档实际上是XML(或SGML)文档,即使仅为XML和SGML文档定义了
有效性。验证涉及

解析,并且必须执行以便检测并报告违反基本XML(或

SGML)语法。

A有效文件可能不符合要求,但符合文件必须是有效文件。


这取决于一致性要求。基于SGML

的语言规范并不要求有效性,这将是奇怪的。对于XML,它是完全不同的
。您可以使用一些

元素和属性定义基于XML的语言,但保持开放式,以便每个人和他的狗可以根据需要添加新标签。毕竟,这就是XHTML(或

XML)经常被广告宣传的内容! :-)

2-创建输入或选择或复选框时,必须将这些嵌入到
a< form>元件。


对于某些必须的值。 HTML

规范中没有这样的要求,无论是在DTD还是在散文部分。事实上,DTD相当意味着相反:它们可能是为了在< form>中允许那些

元素而编写的。只有元素,但它们不是。

现在,如果表单不会向
服务器发送任何数据,那么我只是将action属性分配给一个空字符串,如
这个:

< form action ="">

现在,W3C认为这是严格的HTML 4.01中的有效标记代码。


这是有效的,因为action属性是用CDATA值解析的,

这意味着任何事情都会发生,甚至是一个空字符串。

但HTML Tidy警告说这是错误的或可能是错误的。


这取决于您对URL规范的解释(无论是
空字符串是否为URL)和HTML规范(即URL

规范将被应用 - 建议的标准是

,当发布HTML规范时,或者当前的互联网标准是

URL)。所以这是相当薄的冰。但如果action =" _means_任何东西,它是

相当于一个action属性,文档的基地址为

它的值。简而言之,页面会将表单提交给自己。

如果页面地址实际调用了一个

服务器端脚本,这可能会正常工作(例如,它是一个PHP页面。

当表单不向任何服务器发送任何数据时,最好的办法是什么?


要指定一个引用服务器端脚本的操作属性,

会发回适当的错误代码和错误消息页面,解释

问题有点 - 即使你不期望问题发生。

我应该如何指定action属性以符合验证要求?
1- What''s basically the difference between
- validation, validity
In SGML and XML, validity means that a document conforms to the Document
Type Definition (DTD) it declares to be using. Validation is a process
of checking validity.

Validity is sometimes described as syntactic correctness. However, it''s
not that simple. There are often rules that are clearly syntactic in
nature but cannot be expressed in a DTD, or just have not been expressed
in a DTD. For example, in HTML, an attribute like accesskey="Hello!" (in
an element that may have an accesskey attribute) is valid but
syntactically incorrect. The syntax says that the value must be a single
character, but this limitations is not (and could not be) expressed in a
DTD.

However, people and organizations, even including the W3C, have confused
things by using "validity" a loose word, basically meaning nothing but
"good" (by someone''s taste), except that the use of "validity" makes a
false claim on objectivity and exactness. Moreover, in some areas other
than HTML, but pragmatically related to HTML, "validity" or "validation"
is a technical term, with a meaning that is sufficiently similar to SGML
or XML validity to confuse people. For example, the W3C has coined the
term "valid" for style sheets.

It was probably one of the many unfortunate incidents in the design of
SGML to assign such a technical meaning to the word "valid". But at that
time, it was common to pick up normal English words and to assign a
very, very specifically restricted technical meaning to it - or
sometimes to assign a completely arbitrary meaning to it, quite
independently of any prior normal use of the word. Luckily such things
don''t happen any more in this brave new world. :-)
- well-formedness
This is a foolish pseudo-concept in XML &Co. "Well-formed XML document"
means exactly the same as "XML document". It was meant to distinguish
the basic, low-level syntactic requirements of XML from the various
validity requirements that may be imposed using a DTD. Perhaps also to
allow loose speech about "XML document" about almost-wannabe XML, i.e.
from documents that were meant to be XML but aren''t.
- conformant document
That''s a document that conforms to some standard or specification. A
well-written standard or specification contains a section on conformance
and specifies exactly what is needed for conformance. Note that this
might not imply that the document obeys all recommendations presented in
a specification; the spec may choose to present even strong
recommendations, yet leave them out from conformance requirements. For
example, for XHTML documents, by XHTML specifications, an XML
declaration (<?xml ...>) is strongly recommended, but not required for
conformance.
Basically, what I believe is that a well-formed document might not be
valid but a valid document must be well-formed.
Yes. This of course relates to XML. An XML document might not even have
a DTD. The statement "a valid document must be well-formed" really means
nothing but the fact that only an XML document can be an XML document
that satisfies some special rules. On the practical side, the statement
is not quite that pointless: when verifying validity, we cannot presume
that the document is in fact an XML (or SGML) document, even though
validity is defined for XML and SGML documents only. Validation involves
parsing, and it must be performed so that violations of basic XML (or
SGML) syntax are detected and reported.
A valid document might
not be a conformant one but a conformant document must be a valid one.
That depends on conformance requirements. It would be odd for an SGML
based language specification not to require validity. For XML, it''s
quite different. You could define an XML based language with some
elements and attributes, yet leave it open-ended so that everyone and
his dog can add new tags as desired. After all, that''s what XHTML (or
XML) has often been advertized to be! :-)
2- When creating inputs or select or checkbox, one must nest these into
a <form> element.
For some values of "must". There is no such requirement in HTML
specifications, either in a DTD or in the prose part. In fact, the DTDs
rather imply the contrary: they could have been written to allow those
elements inside a <form> element only, but they weren''t.
Now, if the form is not going to send any data to a
server, then I just assign the action attribute to an empty string like
this:

<form action="">

Now, the W3C considers this as valid markup code in strict HTML 4.01.
It is valid, since the action attribute is declated with CDATA value,
which means that anything goes, even an empty string.
But HTML Tidy warns that this is wrong or possibly wrong.
This depends on your interpretation of the URL specifications (whether
an empty string is a URL) and the HTML specifications (which is the URL
specification to be applied - the one that was the proposed standard
when the HTML spec was issued, or the current Internet-standard on
URLs). So it''s rather thin ice. But if action="" _means_ anything, it is
equivalent to an action attribute with the document''s base address as
its value. Loosely speaking, the page would submit the form to itself.
This may work just fine if the page address actually invokes a
server-side script (e.g., it is a PHP page).
What would be
the best thing to do when a form is not going to send any data to any
server?
To specify an action attribute that refers to a server-side script that
sends back a suitable error code and error message page, explaining the
problem somewhat - even if you don''t expect the problem to occur.
How then should I specify the action attribute in order to
comply with validation requirements?




我描述了安全方法。为了符合验证要求,

只需编写动作="",但在实践中它会更有用于写入动作=&b;哦,这绝对不应该被使用!

(这是有效且语法不正确的。)



I described the safe approach. To comply with validation requirements,
it would suffice to write action="", though in practice it would be more
useful to write action="oh, this is never supposed to be used!".
(It''s valid and syntactically incorrect.)


GérardTalbot< ne ***********@gtalbot.org>写道:
Gérard Talbot <ne***********@gtalbot.org> wrote:
1-什么是基本区别
- 验证,有效性
- 构造良好
- 符合要求的文件


有效期:当文件符合适用的要求时,

DTD。


良好的形式:对文件的要求如果

格式不正确,XML解析器会阻塞代码,因为与

HTML渲染器不同,它无法处理非格式良好的代码。 XHTML作为text / html也需要良好的表现形式

,这次它只与

相关的验证器,它与之无关其他解析器如

浏览器。


符合性文档:HTML规范包含相当多的要求

无法表达一个DTD,这些要求列在

spec'的散文中。现在有所谓的Relax NG HTML检查器,

不只是检查DTD的有效性,他们也(试图)

检查列出的其他要求在规范的散文中。一个这样的

放松NG HTML检查器是 http:// badame .vse.cz / validator /

2-创建输入或选择或复选框时,必须将这些输入嵌入
a< form>元件。现在,如果表单不会向
服务器发送任何数据,那么我只需将action属性分配给空字符串,如
这样:

<表单操作="">

现在,W3C认为这是严格的HTML 4.01中的有效标记代码。
但HTML Tidy警告说这是错误的或可能是错误的。当表单不向任何服务器发送任何数据时,最好的做法是什么?那么我应该如何指定action属性以符合验证要求?
1- What''s basically the difference between
- validation, validity
- well-formedness
- conformant document
Validity: when a document conforms to the requirements of the applicable
DTD.

Well formdness: a requirement for documents that are parsed as XML, if
not well formed an XML parser would choke on the code since unlike an
HTML renderer it cannot handle non well formed code. Well formdness is
also required for XHTML served as text/html, this time it''s only of
relevance to a validator, it''s of no relevance to other parsers such as
browsers.

Conformant document: the HTML spec contains quite a few requirements
that cannot be expressed in a DTD, these requirements are listed in the
spec''s prose. Nowadays there are so called Relax NG HTML checkers that
don''t just check for validity against the DTD, they also (attempt to)
check for the other requirements listed in the spec''s prose. One such an
Relax NG HTML checker is http://badame.vse.cz/validator/
2- When creating inputs or select or checkbox, one must nest these into
a <form> element. Now, if the form is not going to send any data to a
server, then I just assign the action attribute to an empty string like
this:

<form action="">

Now, the W3C considers this as valid markup code in strict HTML 4.01.
But HTML Tidy warns that this is wrong or possibly wrong. What would be
the best thing to do when a form is not going to send any data to any
server? How then should I specify the action attribute in order to
comply with validation requirements?




你可以在你的三个列表中添加一个项目:"正确的HTML" ;.

与其他三个不同,这不是一个定义的术语,并且无法通过机器人检查
,因为它无法明确定义,而且它是'开放给

辩论和意见。


HTML Tidy是一个充其量只能检查良好状态的工具,它

不验证(检查DTD),或检查规范散文中表达的额外

要求。整洁尝试检查

前面提到的正确的HTML。如前所述,使用机器人检查这是不可能的。 Tidy所做的是它使用了一些由它的程序员制定的支票,这些支票可以是有用的,但是因为他们试图这样做不可能的Tidy的支票是

有争议的,有时是完全错误的。


评估HTML的正确性需要一个聪明的人。

正确性因素引起了这个(ciawh)平台的上升和目的,我们在这里讨论这个虚幻的问题。


-

Spartanicus



You could have added an item to your list of three: "correct HTML".
Unlike the other three this is not a defined term, and cannot be checked
by a bot because it cannot be defined unambiguously, and it''s open to
debate and opinion.

HTML Tidy is a tool that at best can check for well formdness, it
doesn''t validate (check against the DTD), or check for the additional
requirements expressed in a spec''s prose. Tidy attempts to check for the
aforementioned "correct HTML". As previously noted it isn''t possible to
check for this with a bot. What Tidy does is it uses a number of checks
that have been drawn up by it''s programmers, these checks can be
helpful, but because they attempt to do the impossible Tidy''s checks are
contentious, and sometimes plain wrong.

Assessing HTML for "correctness" requires an intelligent human being.
The "correctness" factor gives rise and purpose to platforms such as
this (c.i.a.w.h), where we debate this illusive issue.

--
Spartanicus


这篇关于2关于验证的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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