未检测到文档的语法约束(DTD 或 XML 模式) [英] No grammar constraints (DTD or XML schema) detected for the document
问题描述
我有这个 dtd:http://fast-code.sourceforge.net/template.dtd但是当我包含在 xml 中时,我收到警告:未检测到文档的语法约束(DTD 或 XML 架构).xml是:
I have this dtd : http://fast-code.sourceforge.net/template.dtd But when I include in an xml I get the warning : No grammar constraints (DTD or XML schema) detected for the document. The xml is :
<?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,现在出现此错误:
EDIT : I changed the xml, I am getting this error now:
元素类型template"的内容必须匹配(description,variation?,variation-field?,allow-多变?,类模式?,getter-setter?,允许文件扩展名?,需要数量-类?,模板主体)".
The content of element type "template" must match "(description,variation?,variation-field?,allow- multiple-variation?,class-pattern?,getter-setter?,allowed-file-extensions?,number-required- classes?,template-body)".
推荐答案
就我而言,我通过在 标签.
In my case I have solved this annoying warning by simply adding the <!DOCTYPE xml>
after the <?xml ... >
tag.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
这篇关于未检测到文档的语法约束(DTD 或 XML 模式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!