简体   繁体   English

定义属性时,“面板需要属性ID”

[英]“panel requires attribute id” when the attribute is defined

I'm trying to troubleshoot an issue with an izpack installer on windows. 我正在尝试解决Windows上izpack安装程序的问题。 The first step is to the installer from the xml definition, but izpack keeps complaining that <panel> requires attribute 'id' Here's the relevant section: I have ids for the Panels, and appropriate resources, and this file does compile for another user (using an older version of izpack) 第一步是从xml定义转到安装程序,但是izpack一直抱怨<panel> requires attribute 'id'这是相关的部分:我具有Panel的ID和适当的资源,并且此文件确实为另一个用户编译(使用旧版的izpack)

EDIT: Despite the error name, izpack is complaining about things happening when it tries to parse the resources section. 编辑:尽管错误名称,izpack试图解析资源部分时抱怨发生的事情。

<resources>
    <!-- <res id="ImagePanel.img" src="installscreen.jpg"/> -->
    <res id="HTMLHelloPanel.splash" src="./InstallHTML/splash.html"/>
    <res id="LicencePanel.licence" src="Licence.txt"/>
    <res id="HTMLInfoPanel.info" src="./InstallHTML/WindowsInstall_eng.html"/>
    <!-- localization of the info panel -->
    <res id="HTMLInfoPanel.info_fra" src="./InstallHTML/WindowsInstall_fra.html"/>
    <res id="HTMLInfoPanel.info_eng" src="./InstallHTML/WindowsInstall_eng.html"/>
    <res id="HTMLInfoPanel.info_deu" src="./InstallHTML/WindowsInstall_deu.html"/>
    <res id="userInputSpec.xml" src="userInputSpec.xml"/>
    <!--Everything is parsed to this point. The tag below gets choked on -->
    <res id="TargetPanel.dir.windows" src="TargetDir.txt"/>
    <!-- localization of the info panel -->
    <res id="userInputLang.xml_eng" src="userInputLang.xml_eng"/>
    <res id="userInputLang.xml_fra" src="userInputLang.xml_fra"/>
    <res id="userInputLang.xml_deu" src="userInputLang.xml_deu"/>
    <res id="ShortCutPanel.shortcutSpec" src="shortcutSpec.xml"/> 
    <res id="ProcessPanel.Spec.xml" src="ProcessPanel.Spec.xml"/>
    <!-- localization of resource strings -->
    <res id="packsLang.xml_fra" src="packsLang.xml_fra"/>
    <res id="packsLang.xml_eng" src="packsLang.xml_eng"/>
    <res id="packsLang.xml_deu" src="packsLang.xml_deu"/>
</resources>
<!-- The panels section. We indicate here which panels we want to use. The order will be respected. -->
<panels>
    <panel classname="HTMLHelloPanel" id="splash"/>

    <panel classname="HTMLInfoPanel" id="info"/>
    <panel classname="LicencePanel" id="licence"/>
    <panel classname="TargetPanel" id="dir.windows"/> 
    <panel classname="PacksPanel"/>
    <panel classname="InstallPanel"/>
    <panel classname="ShortCutPanel" id="shortcutSpec"/>

</panels>

I'm using the izpack 5.0 snapshot. 我正在使用izpack 5.0快照。

I did not create this file, it is sort of legacy, and the person who originally set it up is no longer with the project. 我没有创建此文件,它有点旧,最初设置该文件的人不再在项目中。 The short version: What about that tag is invalid/different from the others? 简短的版本:那个标签与其他标签无效/不同吗?

EDIT: before someone points it out, PackPanel and LicencePanel don't have any use for ID that I can tell. 编辑:在有人指出之前,PackPanel和LicencePanel对我可以告诉的ID没有任何用处。 I've also tried commenting out all but one of the panels with a listed id, and still get the same error. 我也尝试注释掉除了列出ID的面板以外的所有面板,但仍然收到相同的错误。

Per izpack documentation There is an incompatibility between version 5.0 and previous versions. Per izpack文档 5.0与以前的版本之间不兼容。 Instead of default install destinations being parsed in from a text resource, they are defined as variables. 而不是从文本资源中解析默认安装目标,而是将它们定义为变量。 Not sure why this particular exception is what comes up with this format mistake. 不知道为什么这种特殊的异常是这种格式错误的原因。

The correct implementation for the above is Replace this item: 上面的正确实现是替换以下项目:

<res id="TargetPanel.dir.windows" src="TargetDir.txt"/>

With this: (outside of the resources list) 这样:(在资源列表之外)

<variables>
    <variable name="TargetPanel.dir.windows" value="${$USER_HOME}/Programs/ArtOfIllusion"/>
</variables>

And the target panel is: 目标面板是:

<panel classname="TargetPanel"/>

I'm having a similar issue. 我有一个类似的问题。 Commenting out the UserInputSpec.xml does allow it to compile. 注释掉UserInputSpec.xml确实可以对其进行编译。 Even in that file I have the id attribute defined in the panel tag. 即使在该文件中,我也具有在面板标签中定义的id属性。 Not sure why its still giving the error. 不知道为什么它仍然给错误。

EDIT: You need to make sure that you have the id attribute in UserInputSpec.xml that matches the panel id of your UserInputPanel: 编辑:您需要确保在UserInputSpec.xml中具有与UserInputPanel的面板ID相匹配的id属性:

<userInput>
 <panel id="mypanel">
 ...

Also make sure your filename is UserInputSpec.xml, in my case I was calling the file something else :) 还要确保您的文件名是UserInputSpec.xml,在我的情况下,我正在将该文件其他名称:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM