且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我在哪里可以找到示例XHTML5源代码?

更新时间:2022-10-20 18:33:30

你根本不需要文档类型。它们不是为了处理命名空间而设计的,并且不能用于XML中的任何有用的目的。 (在HTML中,它们是进入标准模式所必需的)。如果你真的坚持要有一个,无论出于何种原因,只需使用<!DOCTYPE html> p>

至于命名空间:

 < html xmlns =http: //www.w3.org/1999/xhtml
xmlns:ui =http://java.sun.com/jsf/facelets>

您已经在使用,我假设。

正如你所看到的,没有关于你使用的版本的信息。那是因为你不需要它。对于验证,您可以在用户界面中选择目标,浏览器从未查看过版本。也就是说,在浏览器中,不存在HTML3.2或HTML4.01或HTML5,只有HTML,没有XHTML1.0,XHTML1.1或XHTML5,只有XHTML。今天,这些主要由HTML4.01 / XHTML1.0和HTML5的一些部分以及一些专有部分组成(尽管HTML5已经指定了其中的大部分)。


Where can I find sample XHTML 5 pages? I mainly want to know if it is possible to mix and match XHTML 5 with other XML languages just like XHTML 1 or not. For example is something like this valid in XHTML 5?

<!DOCTYPE html PUBLIC "WHAT SHOULD BE HERE?" 
          "WHAT SHOULD BE HERE?">
<html xmlns="WHAT SHOULD BE HERE?"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
  <title><ui:insert name="title">Default title</ui:insert></title>
  <link rel="stylesheet" type="text/css" href="./css/main.css"/>
</head>

<body>

<div id="header">
    <ui:insert name="header">
        <ui:include src="header.xhtml"/>
    </ui:insert>
</div>


<div id="left">
  <ui:insert name="navigation" >
    <ui:include src="navigation.xhtml"/>
  </ui:insert>
</div>


<div id="center">
  <br />
  <span class="titleText"> <ui:insert name="title" /> </span>
  <hr />
  <ui:insert name="content">
    <div>
    <ui:include src="content.xhtml"/>  
    </div>
  </ui:insert>
</div>

<div id="right">
  <ui:insert name="news">
    <ui:include src="news.xhtml"/>
  </ui:insert>
</div>

<div id="footer">
  <ui:insert name="footer">
    <ui:include src="footer.xhtml"/>  
  </ui:insert>
</div>

</body>

</html>

Thanks in advance.

You don't need a doctype at all. They are not designed to cope with namespaces and don't serve any useful purpose in XML. (In HTML, they are necessary to get into standards mode.) If you really insist on having one, for whatever reason, use simply <!DOCTYPE html>.

As for the namespace:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets">

as you are already using, I assume.

As you see, there is no information about the version you're using. That's because you don't need it. For validation, you can pick your target in the UI, and browsers have never looked at versions. That is, in browsers, there is no such thing as HTML3.2 or HTML4.01 or HTML5, just "HTML", and no XHTML1.0, XHTML1.1 or XHTML5, only "XHTML". Today, those consist mainly of HTML4.01/XHTML1.0 and some parts of HTML5, as well as some proprietary parts (though HTML5 has specified most of these).