检测到文档没有语法约束(DTD或XML模式)

前端之家收集整理的这篇文章主要介绍了检测到文档没有语法约束(DTD或XML模式)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有这个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,我得到这个错误现在:

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)”.

在我的情况下,我已经解决了这个讨厌的警告,只需添加<!DOCTYPE xml>之后的< xml? ...>标签
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
原文链接:https://www.f2er.com/xml/294212.html

猜你在找的XML相关文章