开发者

Can I reference an external sgml declaration from within a sgml document?

I'm more used to xml documents and tools, but I need to deal with sgml. I have an sgml document that I'm using nsgmls to parse, and I need to include a particular sgml declarati开发者_如何学JAVAon with it. It works fine if I specify the declaration file on the command line:

$ nsgmls mydoc.decl mydoc.sgml

But I'd like to include the reference to the declaration within the sgml file (and not the entire declaration). Including it like a xml doctype i.e., <!DOCTYPE MyDoc SYSTEM "mydoc.decl"> fails with

mydoc.decl:1:2:E: unknown declaration type "SGML"

and the declaration isn't parsed (leading to lots of other errors). Trying to do the same thing as a SGML declaration: <!SGML MyDoc SYSTEM "mydoc.decl"> isn't any better, that gives me a fatal error:

mydoc.decl:1:0:E: character "<" invalid: only minimum literal and parameter separators allowed
mydoc.decl:1:0:E: cannot continue because of previous errors

Is there any way to just reference the external file, or will I always need to specify it on the command line?


You can't reference the SGML declaration from the DOCTYPE declaration. The DOCTYPE declaration should only point to the DTD.

What you can do though create a file named catalog (no extension) with an SGMLDECL entry in it. If you put this file in the same location as your SGML document, nsgmls will use it.

You can also point to the catalog file using -c on the command line, but that would defeat the purpose for you since you're trying not to reference anything else from the command line.

Here's an example catalog file pointing to a different SGML declaration file:

SGMLDECL somedir/mydoc.decl

If you have that catalog file in the same directory as "mydoc.sgml", you can leave the sgml declaration out of the command line:

nsgmls mydoc.sgml
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜