关于如何引用不同 DTD 的一个小问题
如果这个问题太简单,请原谅我,因为我只是这个领域的初学者。
我的客户曾经长期使用名为“article.dtd”的 dtd。现在,他们决定稍微扩展该 dtd,添加更多元素,并将其重命名为“project.dtd”。由于添加到article.dtd 中的新元素只有几行,因此他们不想在每次创建project.dtd 时复制article.dtd 中的所有内容。
因此,我正在寻找一种方法,是否可以从新创建的project.dtd中引用article.dtd,并且在project.dtd中,我们只需要放入article.dtd中未包含的那些行?
仅供参考,这些是在project.dtd 中添加的四行:
<!ELEMENT project (title, keywords?, feature?, related-terms?, abstract?, classification?, contributor*, reviewer?, materials?, body, related-links?, questions?)>
<!ATTLIST project %common-atts; %status-atts; %profile-atts;>
<!ELEMENT abstract ((%para-elems;)+)>
<!ATTLIST abstract %common-atts;>
感谢您提前的帮助。
please pardon me if this is too simple question, since I am just a beginner in this field.
My client used to work with a dtd, called "article.dtd" for a long time. Now they decided to extend that dtd a little bit, with some more elements and rename it as "project.dtd". Since the new elements added to the article.dtd is of just a few lines, they don't want to copy everything from article.dtd everytime they create project.dtd.
Thus, I am seeking a way, if it is possible to reference article.dtd from newly-created project.dtd, and in project.dtd, we only need to put in those lines that are not contained in article.dtd?
FYI, these are the four lines that are added in project.dtd:
<!ELEMENT project (title, keywords?, feature?, related-terms?, abstract?, classification?, contributor*, reviewer?, materials?, body, related-links?, questions?)>
<!ATTLIST project %common-atts; %status-atts; %profile-atts;>
<!ELEMENT abstract ((%para-elems;)+)>
<!ATTLIST abstract %common-atts;>
Thanks for the help in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以使用参数实体来完成此操作。 (看起来您已经使用了很多参数实体。)
您将需要添加一个参数实体声明 (
) 和一个参数实体引用(
%entity-name;
)。以下是使用实体名称
article-dtd
的示例。这将是完整的project.dtd
:我仅在实体声明中使用了 SYSTEM 标识符,但您也可以添加 PUBLIC 标识符。
例子:
Yes, you can do this with a parameter entity. (It looks like you're using a lot of parameter entities already.)
You will need to add a parameter entity declaration (
<!ENTITY % entity-name ...>
) and a parameter entity reference (%entity-name;
).Here's an example using the entity name
article-dtd
. This would be your completeproject.dtd
:I only used a SYSTEM identifier in the entity declaration, but you can add a PUBLIC identifier too.
Example: