HTML5 Pass-Through元素会导致Eclipse警告“未知标记” [英] HTML5 Pass-Through element causes Eclipse warning 'Unknown tag'

查看:218
本文介绍了HTML5 Pass-Through元素会导致Eclipse警告“未知标记”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE html>

< html xmlns =http://www.w3.org/1999/xhtml
xmlns:f =http://java.sun.com/jsf/core
xmlns:ui =http://java.sun.com/jsf/facelets
xmlns:h =http://java.sun.com/jsf/html
xmlns:p =http://primefaces.org/ui
xmlns:jsf =http://xmlns.jcp.org/jsf>

< h:head>
...
< / h:head>
< h:body>
< header jsf:id =head>
...
< / header>
< nav jsf:id =nav>
...
< / nav>
< main jsf:id =main>
...
< / main>
< footer jsf:id =foot>
...
< / footer>
< / h:body>
< / html>

Eclipse抱怨


未知的标签(主)。


我想知道我的文件是不是有些畸形,还是Eclipse只是无法验证这是正确的。

解决方案

这不是一个JSF问题。删除passthrough元素触发器 jsf:id 时,您仍然会遇到完全相同的问题。即使在XHTML文件中的任何地方不使用JSF标签/属性,您仍然会遇到同样的问题。



< main> 标签在HTML5中相对较新(仅在中添加2013年8月的HTML5 CR )。您的XHTML文档中的其他HTML5标签已经存在较长时间(早在2008年)。 Eclipse简单地将< main> 识别为在 http://www.w3.org标识的默认XML命名空间中注册的标签/ 1999 / XHTML 。 Eclipse拥有已注册标签的内部列表。如果升级到最新的Eclipse(SR)版本并不能解决问题,那么最好的办法就是把这个报告给Eclipse的人。同时,只需选择快速修复选项忽略HTML5验证中的主要元素





$ b $对于具体的问题,这个XML序言并不属于这个问题,而是与不相关的。摆脱它此外,我还想知道header,nav,main和footer是整个JSF组件的必要性。我没有真正看到任何有用的真实世界电器。你最有可能保持纯粹的HTML。



另请参见:




My JSF template.xhtml file looks something like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:jsf="http://xmlns.jcp.org/jsf">

<h:head>
    ...
</h:head> 
<h:body>
    <header jsf:id="head">
        ...
    </header>
    <nav jsf:id="nav">
        ...
    </nav>
    <main jsf:id="main">
        ...
    </main>
    <footer jsf:id="foot">
        ...
    </footer>
</h:body>
</html>

Eclipse complains about the

Unknown tag (main).

I wonder whether my file is somehow malformed or Eclipse is just not capable of validating this correctly.

解决方案

This is not a JSF problem. You would still have exactly the same problem when removing the passthrough element trigger jsf:id. You would even still have exactly the same problem when not using JSF tags/attributes anywhere in the XHTML file.

The <main> tag is relatively new in HTML5 (it was only added in HTML5 CR of August 2013). Other HTML5 tags currently in your XHTML document already exist longer (far back in 2008). Eclipse simply doesn't recognize <main> as a tag registered in the default XML namespace as identified by http://www.w3.org/1999/xhtml. Eclipse holds an internal list of registered tags. If upgrading to latest Eclipse (SR) version doesn't solve the problem, then your best bet is to report this as an issue to Eclipse guys. In the meanwhile, just choose the quick fix option "Ignore 'main' element in HTML5 validation".


Unrelated to the concrete problem, that XML prolog doesn't belong there. Get rid of it. Further I also wonder the necessity of the "header", "nav", "main" and "footer" being whole JSF components. I'm not really seeing any useful real world appliances with this. You'd most likely as good just keep them plain HTML. This saves you from unnecessary overhead.

See also:

这篇关于HTML5 Pass-Through元素会导致Eclipse警告“未知标记”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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