如何让IntelliJ识别wicket html标签?

时间:2021-05-30 00:08:27

I'm using IntellIJ with Apache Wicket and IntelliJ is showing me that tags like <wicket:extend> and <wicket:container> and adding wicket:id to other html tags is not valid.

我使用的是IntellIJ和Apache Wicket, IntellIJ向我展示了像< Wicket:extend>和< Wicket:container>这样的标签,在其他html标签中添加Wicket:id是无效的。

What steps do I need to take to make IntelliJ recognize the wicket tags?

我需要采取什么步骤才能让IntelliJ识别出wicket标签?

I'm using IntelliJ Ultimate 9 with the wicketforge plugin.

我正在使用IntelliJ Ultimate 9和wicketforge插件。

4 个解决方案

#1


4  

You can't really do it, adding the wicket namespace as in the other answer will only work for wicket:id, there is no dtd that also includes the wicket:container|panel etc.

实际上,您不能这样做,添加wicket名称空间(另一个答案)只适用于wicket:id,没有dtd也包括wicket:container|面板等等。

There is this really old schema from the contrib project: http://wicket-contrib.googlecode.com/files/wicket.xsd but that doesn't include xhtml, so you'd need to create a schema to merge that and xhtml, and i don't believe there is a way other then manual.

有一个非常古老的模式来自于这个悔过项目:http://wicket-悔过书。googlecode.com/files/wicket.xsd,但是它不包括xhtml,所以您需要创建一个模式来合并它和xhtml,我认为除了手工之外,没有其他方法。

The best you can do it add them to idea's ignored tags;

你能做的最好的就是把它们添加到idea的忽略标签中;

#2


3  

I use Eclipse, but to make validation errors go away, I just add the wicket namespace:

我使用Eclipse,但是为了消除验证错误,我添加了wicket名称空间:

<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
    ...
</html>

#3


1  

I suspect @slckin may be right. and to contribute to his answer, In IDEA, File->Settings->Inspections->HTML "Unknown HTML tag" is where you can add a list of comma seperated tags, mine looks like this: nobr,noembed,comment,noscript,embed,script,wicket:head,wicket:panel,wicket:remove,wicket:extend,wicket:child,wicket:container,wicket:enclosure,wicket:message,wicket:link,wicket:fragment (not a complete list but covers most) The best list of the tags in one place I've found is here: https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
The next block section down is "Unknown HTML tag attribute" and if you add wicket:id to the "Custom HTML tag attributes" list it should stop throwing that warning as well.

我怀疑@slckin可能是对的。在这里,你可以添加一个逗号分隔的标签列表,我的列表是这样的:nobr,noembed,comment, embed,script, embed,script,wicket:head,wicket,wicket:面板,wicket,片段I:移除,wicket: wicket:https://cwiki.apache.org/wicketss-xhtml -tags.html下一节是“未知的HTML标记属性”,如果您将wicket:id添加到“自定义HTML标记属性”列表中,它也应该停止抛出这个警告。

#4


1  

In "Project Settings - Schemas and DTDs" you can add the http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd DTD (download it save it somewhere, then browse to its location).

在“项目设置-模式和DTD”中,您可以添加http://wicket.apache.org/dtds.data/wicket-xhtml1.4 . DTD DTD(下载它保存在某个地方,然后浏览到它的位置)。

That will at least get rid of the warning about the undefined namespace, and make the red warnings less obtrusively brown, assuming your HTML files start with the following:

这至少可以消除关于未定义名称空间的警告,并降低红色警告的棕色程度,假设您的HTML文件以以下内容开头:

<?xml encoding="UTF-8" ?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
  lang="en" xml:lang="en">

(The first <?xml encoding="UTF-8" ?> is stripped away by wicket, used just to specify UTF-8 encoding)

(第一个< ?xml编码="UTF-8" ?>被wicket剥离,用于指定UTF-8编码)

Then follow Raystorm's advice about adding the unknown HTML tag definitions.

然后按照Raystorm的建议添加未知的HTML标记定义。

Only problem I have now is that I get double type-completion suggestions for the <wicket:whatever elements, but it beats having error-markers everywhere.

现在唯一的问题是,我得到了 元素的双类型完成建议,但总比到处都有错误标记要好。

#1


4  

You can't really do it, adding the wicket namespace as in the other answer will only work for wicket:id, there is no dtd that also includes the wicket:container|panel etc.

实际上,您不能这样做,添加wicket名称空间(另一个答案)只适用于wicket:id,没有dtd也包括wicket:container|面板等等。

There is this really old schema from the contrib project: http://wicket-contrib.googlecode.com/files/wicket.xsd but that doesn't include xhtml, so you'd need to create a schema to merge that and xhtml, and i don't believe there is a way other then manual.

有一个非常古老的模式来自于这个悔过项目:http://wicket-悔过书。googlecode.com/files/wicket.xsd,但是它不包括xhtml,所以您需要创建一个模式来合并它和xhtml,我认为除了手工之外,没有其他方法。

The best you can do it add them to idea's ignored tags;

你能做的最好的就是把它们添加到idea的忽略标签中;

#2


3  

I use Eclipse, but to make validation errors go away, I just add the wicket namespace:

我使用Eclipse,但是为了消除验证错误,我添加了wicket名称空间:

<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
    ...
</html>

#3


1  

I suspect @slckin may be right. and to contribute to his answer, In IDEA, File->Settings->Inspections->HTML "Unknown HTML tag" is where you can add a list of comma seperated tags, mine looks like this: nobr,noembed,comment,noscript,embed,script,wicket:head,wicket:panel,wicket:remove,wicket:extend,wicket:child,wicket:container,wicket:enclosure,wicket:message,wicket:link,wicket:fragment (not a complete list but covers most) The best list of the tags in one place I've found is here: https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
The next block section down is "Unknown HTML tag attribute" and if you add wicket:id to the "Custom HTML tag attributes" list it should stop throwing that warning as well.

我怀疑@slckin可能是对的。在这里,你可以添加一个逗号分隔的标签列表,我的列表是这样的:nobr,noembed,comment, embed,script, embed,script,wicket:head,wicket,wicket:面板,wicket,片段I:移除,wicket: wicket:https://cwiki.apache.org/wicketss-xhtml -tags.html下一节是“未知的HTML标记属性”,如果您将wicket:id添加到“自定义HTML标记属性”列表中,它也应该停止抛出这个警告。

#4


1  

In "Project Settings - Schemas and DTDs" you can add the http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd DTD (download it save it somewhere, then browse to its location).

在“项目设置-模式和DTD”中,您可以添加http://wicket.apache.org/dtds.data/wicket-xhtml1.4 . DTD DTD(下载它保存在某个地方,然后浏览到它的位置)。

That will at least get rid of the warning about the undefined namespace, and make the red warnings less obtrusively brown, assuming your HTML files start with the following:

这至少可以消除关于未定义名称空间的警告,并降低红色警告的棕色程度,假设您的HTML文件以以下内容开头:

<?xml encoding="UTF-8" ?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
  lang="en" xml:lang="en">

(The first <?xml encoding="UTF-8" ?> is stripped away by wicket, used just to specify UTF-8 encoding)

(第一个< ?xml编码="UTF-8" ?>被wicket剥离,用于指定UTF-8编码)

Then follow Raystorm's advice about adding the unknown HTML tag definitions.

然后按照Raystorm的建议添加未知的HTML标记定义。

Only problem I have now is that I get double type-completion suggestions for the <wicket:whatever elements, but it beats having error-markers everywhere.

现在唯一的问题是,我得到了 元素的双类型完成建议,但总比到处都有错误标记要好。