我有这个dtd:http : //fast-code.sourceforge.net/template.dtd 但是当我包含在xml中时,我得到了警告:没有为文档检测到语法约束(DTD或XML模式)。xml是:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE templates PUBLIC "//UNKNOWN/" "http://fast-code.sourceforge.net/template.dtd">
<templates>
<template type="INSTANCE_OF_CLASS">
<description>Used to Create instance of class</description>
<variation>asasa</variation>
<variation-field>asasa</variation-field>
<class-pattern>asasa</class-pattern>
<getter-setter>setter</getter-setter>
<allowed-file-extensions>java</allowed-file-extensions>
<number-required-classes>1</number-required-classes>
<allow-multiple-variation>false</allow-multiple-variation>
<template-body>
<![CDATA[
// Creating new instance of ${class_name}
final ${class_name} ${instance} = new ${class_name}();
#foreach ($field in ${fields})
${instance}.${field.setter}(${field.value});
#end
]]>
</template-body>
</template>
</templates>
编辑:我更改了xml,现在出现此错误:
元素类型“模板”的内容必须匹配“(描述,变量?,变量字段?,允许多变量?,类模式?,getter-setter ?、允许文件扩展名?,需要数字?类?,模板主体)”。