关于如何引用不同 DTD 的一个小问题

发布于 2024-10-30 06:14:26 字数 702 浏览 2 评论 0原文

如果这个问题太简单,请原谅我,因为我只是这个领域的初学者。

我的客户曾经长期使用名为“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧城空念 2024-11-06 06:14:26

是的,您可以使用参数实体来完成此操作。 (看起来您已经使用了很多参数实体。)

您将需要添加一个参数实体声明 () 和一个参数实体引用(%entity-name;)。

以下是使用实体名称 article-dtd 的示例。这将是完整的 project.dtd

<!ENTITY % article-dtd SYSTEM "article.dtd">
%article-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;>

我仅在实体声明中使用了 SYSTEM 标识符,但您也可以添加 PUBLIC 标识符。

例子:

<!ENTITY % article-dtd PUBLIC "-//SO//Stackoverflow Test//EN" "article.dtd">

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 complete project.dtd:

<!ENTITY % article-dtd SYSTEM "article.dtd">
%article-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;>

I only used a SYSTEM identifier in the entity declaration, but you can add a PUBLIC identifier too.

Example:

<!ENTITY % article-dtd PUBLIC "-//SO//Stackoverflow Test//EN" "article.dtd">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文