Documents must be well-formed
Well-formedness is a new concept introduced by [XML]. Essentially this means that all elements must either have closing tags or be written in a special form (as described below), and that all the elements must nest.
Although overlapping is illegal in SGML, it was widely tolerated in existing browsers.
良好的xml文档结构,比如下面的代码不正确(overlapping elements)
here is an emphasized paragraph.
Element and attribute names must be in lower case
元素和属性名必须小写
For non-empty elements, end tags are required
标签必须有结束标志
Attribute values must always be quoted
属性值必须有引号
下面的 3 必须用引号括起来
“3“>
Attribute Minimization
支持最少的属性。很多html的属性在 xhtml中消失了,比如 img align=”absmiddle”
Empty Elements
空元素也必须结束,如
Whitespace handling in attribute values
属性值中,头、尾的空格将会忽略,中间多个连续空格也将视为一个。
Script and Style elements
script 和 style 必须声明如下:
... unescaped script content ...
]]>
> & 等符号必须转义为 > & 等
另一种办法就是使用外部引用.js和.css文件。
SGML exclusions
SGML gives the writer of a DTD the ability to exclude specific elements from being contained within an element. Such prohibitions (called “exclusions”) are not possible in XML.
For example, the HTML 4 Strict DTD forbids the nesting of an ‘a’ element within another ‘a’ element to any descendant depth. It is not possible to spell out such prohibitions in XML. Even though these prohibitions cannot be defined in the DTD, certain elements should not be nested. A summary of such elements and the elements that should not be nested in them is found in the normative Appendix B.
The elements with ‘id’ and ‘name’ attributes
xhtml中只有a, applet, form, frame, iframe, img 和 map 标签具有name属性。其它只能用 id 。注意,将来所有name都会被放弃,全部使用id。
原文来自:
http://www.w3.org/TR/2000/REC-xhtml1-20000126/
[Edit on 2005-10-26 14:21:59 By guoshuang]
[Edit on 2005-12-18 15:52:09 By guoshuang]
Leave a reply