设计目的(Design Aims)
- 通用xhtml:如果一个设备裡有xml,尝试重覆使用
- 更多的结构:使用style sheet定义外观
- 更多的通用性:限制範围内的xml,试着让xml更容易撰写,产生的文件,更容易使用
- 更多的平台可使用(更容易存取):设计应更具包容性
- 更好的国际化:因为她更广泛运用于所有网路
- 更多独立的设备:新设备上市,如电话、平版电脑、数位电视,意味着必须要有一个设计,让你一次于各种不同的设备呈现画面,而不是针对每一个设备设计不同的文件
- 更少的脚本:程式设计师透过script,限制user存取的类型是难以实现的功能。xhtml 2使用目前典型做法,包括那些标记。
- 结合语意网:使XHTML2 适合处理语意网的工具
向后兼容(Backwards compatibility)
早期版本html特殊用途的语言,因为必须确保相容旧得浏览器,并且兼容于新的语言与新的浏览器。
由于xml和样式表,这种严格的元素,向后兼容性不再是必要的,这是基于xml的浏览器,其中在显示的时候,是指95%以上的浏览器,在使用中,没被更新的情况下,可以处理新的标记语言。xhtml 2在运作时,已经可以相容于现在大多数的浏览器,但不是所有浏览器。
xhtml2可以增加html表单和表格,许多人们不得不等待新版本的浏览器才能够使用新的功能,xhtml2差异,主要是xforms和xml事件
XHTML 2连结(XHTML 2 and Linking)
The original versions of HTML relied upon built-in knowledge on the part of User Agents and other document processors. While much of this knowledge had to do with presentation (see above), the bulk of the remainder had to do with the relationships between documents — so called "linking".
A variety of W3C and other efforts, most notably XLINK, attempted to create a grammar for defining the characteristings of linking. Unfortunately, these grammars all fall short of the requirements of XHTML. The community is continuing in its efforts to create a comprehensive grammar that describes link characteristics.
The HTML Working Group has determined that such a grammar, while generally useful, is not required for the definition of XHTML 2. Instead, this document is explicit in the characteristics of the elements and attributes that are used to connect to other resources. The Working Group has taken this course because 1) the problem with XHTML 2 is well bounded, 2) the general solution is slow in coming, and 3) it will be easier for implementors to support and users to rely upon
xhtml 1主要差异(Major Differences with XHTML 1)
xhtml 2的设计是可识别的html和xhtml 1程式设计师,同时纠正早期版本html错误和不足,并利用这个机会作出改善。
最明显的变化如下:
-
更结构化的可能性:
-
部分标题:从不同层次的结构推断是否是以前版本的html文档,程式设计师误用标题元素的视觉效果。这是一个问题。
xhtml 2让你明确标记文档结构的部分元素,和其相关的section元素h。 - 分离器(Separators):在以前版本的html,hr元素被用于分开部分彼此文件。回想起来,名hr(水平线)是误导性的,因为hr不一定是水平(在垂直文本中,它是垂直的),规则也不一定(书籍,往往用其他印刷方法,如线的叁个星号,但用style sheet可以让你更自由发挥)。为了强调其结构性质,使其更广泛使用,以便更清楚地,它没有必要的方向性,hr已更名为separator分隔符。
- 换行(Line breaks):以前版本的html,一段文字使用br元素分成几个'断行'。这些文件做出了明确的xhtml 2的"l"元素。还有其它优点,如自动编号线的能力,或以不同的方式交替行着色。
- 段落结构(Paragraph structure):在早期版本的html,一个p元素只能包含简单的文本,它已得到改进,p元素更接近人认为其作为一个段落,现在被允许列表和表格。
-
部分标题:从不同层次的结构推断是否是以前版本的html文档,程式设计师误用标题元素的视觉效果。这是一个问题。
-
图片(image):html img元素有很多缺点,只允许你指定一个单一资源的图像,而不是对象元素提供了后备的机会;唯一的备用选项,就是alt文本,只能是纯文本,而不是标记以任何方式;longdesc属性,它允许你提供一个长期的形象的描述是难事
xhtml 2採用完全不同的方法,所有的图像都有很长的描述和处理图像和文本,在xhtml2的任何元素都可能有一个@src属性,如果资源是不可用的(因为它是一个类型,浏览器无法处理,因为图像已被关闭),则该元素被代替。从本质上讲,longdesc已被移动到documen,儘管这种模拟备註行为,(实现工具提示的效果,一些浏览器与alt属性,在html 4中,您使用的@title属性) - Type(类型): in HTML 4, the @srctype attribute when referring to an external resource was purely a hint to the user agent. In XHTML 2 it is no longer a hint, but specifies the type(s) of resource the user agent must accept.
- 表格(table):表的内容模型已经被清理和简化,同时仍然允许相同的功能。
- Bi-directional text(双向文本): rather than use an explicit element to describe bi-directional override, new values have been added to the @dir attribute that allow bi-directional override on any element.
- 编辑:比较明确的ins and del变化塬理,@edit为同样的目的可以使用任何元素。
-
连结:只有一个元素以超链接的来源和目标。在html 4和xhtml1中,任何元素可以是一个超链接的目标,但仍然只有一个元素的来源。 在xhtml2的任何元素现在也可以以超链接的源,@href和其相关的属性,因为现在可以出现在任何元素。
因此例如, <li><a href="home.html">Home< /a>< /li>,你现在可以写 <li href="home.html">Home< /li>.即使这意味着一个元素是现在严格来说不必要的,它已被保留。 - Metadata: the meta and link元素是广义的,RDF关係描述。此外,这两种元素的属性可以被更普遍地应用于跨越语言。
-
Role:为了帮助加入语义的文件,@Role 属性已被增加,以及有用的值的一组初始,以一个特定元素的使用分类。比如,一个段可能发挥的作用的说明,可能 会被标记
.
-
Events: event handling in HTML was restricted in several ways: since the event names were hard-wired in the language (such as onclick), the only way to add new events was to change the language; many of the events (such as click) were device-specific, rather than referring to the intent of the event (such as activating a link); you could only handle an event in one scripting language — it was not possible to supply event handlers in the same document for several different scripting languages.
XHTML 2 uses XML Events XMLEVENTS to specify event handling, giving greater freedom in the ability to handle events. Along with this, the script element has been renamed handler to indicate its different semantics. - Forms:html形式于1993年推出,的电子商务革命来临之前,现在拥有超过十年的使用经验的,他们已经彻底检修和更新,以满足XForms的形式,这是xhtml 2的一个组成部分。
- 应有的所有权:自html 4是一个独立的应用程序,它定义了许多事情,不再需要被定义,它是一个xml应用程序。例如通过xml定义的空白输入,和style sheet的输出,同样的,@media属性值的定义被转移到相关的样式表语言。
- Frames and Framesets: In HTML 4 multi-panel "pages" could be described using the frameset and frame elements. The Frames model is no longer defined in XHTML. Instead, it is defined through the separate[XFRAMES] specification.
What are the XHTML 2 Modules?(什么是xhtml 2模组)
XHTML 2 is a member of the XHTML Family of markup languages. It is an XHTML Host Language as defined in XHTML Modularization. As such, it is made up of a set of XHTML Modules that together describe the elements and attributes of the language, and their content model. XHTML 2 updates many of the modules defined in XHTML Modularization
1.1 [XHTMLMOD], and includes the updated versions of all those modules and their semantics. XHTML 2 also uses modules from XHTML Access [XHTMLACCESS], XHTML Role [XHTMLROLE], RDFa Syntax [RDFASYNTAX], Ruby[RUBY], XML Events [XMLEVENTS], and XForms [XFORMS].
The modules defined in this specification are largely extensions of the modules defined in XHTML Modularization 1.1. This specification also defines the semantics of the modules it includes. So, that means that unlike earlier versions of XHTML that relied upon the semantics defined in HTML 4 [HTML4], all of the semantics for XHTML 2 are defined either in this specification or in the specifications that it normatively references.
Even though the XHTML 2 modules are defined in this specification, they are available for use in other XHTML family markup languages. Over time, it is possible that the modules defined in this specification will migrate into an update of the XHTML Modularization specification.
若哪里有错,请跟我留言给我,谢谢!
参考资料:
- XHTML2.0 Introduction
- 语意搜寻 (Semantic Search): 挖掘搜寻产业的整座冰山
- XLINK
- RDFa
