开发者

DTD Remote Reference Problem

I have a customized dtd that contains a reference to a remote dtd like:

<!ENTITY % table.model     PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" "http://www.docbook.org/sgml/4.2/soextblx.dtd">

However, docbook site was down for at least 1 day in mid March 2011, our content won't validate. So I was thinking making a local copy of the soextblx.dtd and change reference to that may help, like:

  <!ENTITY % table.model     PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" "soextblx.dtd">

Assuming that I have put "soextblx.dtd" in the same folder as my customized dtd. I have used XmlSpy to validate it, which is validated, but I am not sure whether this is the correct or best solution for this kind of server-down problem that may happen in the future.

Thanks for开发者_Go百科 the help in advance.


Interesting approach @ mzjn -- seems like XML catalog is an abstraction of the public/system concept.

Back to your original question -- you are doing it the right way according to the DTD ref regarding the External Entity declaration.

Relevant excerpt:

A URI might thus be relative to the document entity, to the entity containing the external DTD subset, or to some other external parameter entity. Attempts to retrieve the resource identified by a URI may be redirected at the parser level (for example, in an entity resolver) or below (at the protocol level, for example, via an HTTP Location: header). In the absence of additional information outside the scope of this specification within the resource, the base URI of a resource is always the URI of the actual resource returned. In other words, it is the URI of the resource retrieved after all redirection has occurred.


The best general solution to this kind of problem is to use an XML catalog. In short, a catalog provides a mapping from generic identifiers to specific (local) files or URIs.

Here are two good articles about catalogs (especially useful for DocBook users):

  • http://www.sagehill.net/docbookxsl/Catalogs.html.
  • http://xml.apache.org/commons/components/resolver/resolver-article.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜