没有为文档检测到语法约束(DTD或XML模式) [英] No grammar constraints (DTD or XML schema) detected for the document

查看:757
本文介绍了没有为文档检测到语法约束(DTD或XML模式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个dtd: http://fast-code.sourceforge.net/template.dtd
但是当我包含一个xml我收到警告:
没有为文档检测到语法约束(DTD或XML模式)。
xml是:

 <?xml version =1.0encoding =UTF-8?> ; 
<!DOCTYPE templates PUBLIC// UNKNOWN /http://fast-code.sourceforge.net/template.dtd\">

< templates>
< template type =INSTANCE_OF_CLASS>
< description>用于创建类< / 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 [
//创建$ {class_name}的新实例
final $ {class_name} $ {instance} = new $ {class_name}();
#foreach($ field in $ {fields})
$ {instance}。$ {field.setter}($ {field.value});
#end
]]>
< / template-body>
< / template>
< / templates>

编辑:我更改了xml,我现在得到这个错误:


元素类型模板的内容必须匹配(description,variation?,variation-field?,allow-
多变量?,类模式?,getter-setter?,allowed-file-extensions?,number-required-
classes?,template-body)。



解决方案

在我的情况下,我已经解决了这个烦人的警告,只需添加<!DOCTYPE xml> <?xml ...> 标签。

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE 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>

EDIT : I changed the xml, I am getting this error now:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆