在没有DTD“方案”的情况下定义XML实体

时间:2021-12-15 16:30:33

I'd like to use XML entities to define text snippets shortcuts. But for that, I need to define DTD:

我想使用XML实体来定义文本片段快捷方式。但为此,我需要定义DTD:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ruleset [
    <!ENTITY useCli SYSTEM "Define this setting using JBoss CLI or the web console.">
]>
<ruleset id="..."

But this doesn't work since XML tools complain about the ruleset element not being defined. So I tried

但这不起作用,因为XML工具抱怨未定义规则集元素。所以我试过了

    <!ELEMENT ruleset ANY>

But then it wants the child elements, attributes etc.

但是它需要子元素,属性等。

Is there a way to define a XML entity without defining the whole DTD? (There is a XSD schema for that document.)

有没有办法在不定义整个DTD的情况下定义XML实体? (该文档有一个XSD架构。)

1 个解决方案

#1


0  

XSD is an alternative to DTD. If you have an XSD you shouldn't need a DTD. If you do, you can always convert it: http://bsp.mits.ch/xsd2dtd/

XSD是DTD的替代品。如果您有XSD,则不需要DTD。如果你这样做,你可以随时转换它:http://bsp.mits.ch/xsd2dtd/

#1


0  

XSD is an alternative to DTD. If you have an XSD you shouldn't need a DTD. If you do, you can always convert it: http://bsp.mits.ch/xsd2dtd/

XSD是DTD的替代品。如果您有XSD,则不需要DTD。如果你这样做,你可以随时转换它:http://bsp.mits.ch/xsd2dtd/