Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#3 psgml does not understand file: syntax

open
nobody
None
5
2001-04-26
2001-04-26
Anonymous
No

Hi,

I'm trying to use PSGML together with java applications
which
use the JAXP parser. One prominent application is the
"ant"
build tool from the jakarta project.

If I write my DOCTYPEs like this:

<!DOCTYPE project SYSTEM "conf/project.dtd">

then emacs (I use emacs 20.7.1 as distributed by RedHat
with
their 6.2 distribution) happily parses all the DTDs and
their
entities (C-c C-p ==> no errors).

But ant (and the JAXP 1.0.1 / JAXP 1.1) parser choke on
these
lines as they expect the DOCTYPEs be written like this:

<!DOCTYPE project SYSTEM "file:conf/project.dtd">

If I put a "file:" in front of all external references,
then JAXP
and ant are happy. But PSGML is no longer.

I'm in some sort of Catch-22. What can I do? Is it
possible to
teach the file: syntax to emacs?

Discussion

  • Logged In: NO

    I have the same problem. I want psgml to read the DTD from
    a webserver though for team development DTD sharing. If
    someone can point me in the right direction I'd like to try
    to support http: and file: URLs.

     
  • Logged In: YES
    user_id=552189

    (Based on a reaction from Lennart in a mailing list:)

    (defun sgml-url-sysid (sysid)
    (cond ((string-match "^file:" sysid)
    (insert-file-contents (substring sysid (match-end 0)))
    t)
    (t nil)))

    (add-hook 'sgml-sysid-resolve-functions 'sgml-url-sysid)

    This does it nicely. Note however that there is a potential
    problem
    (and also one that makes it harder to generalise this
    function):
    double slashes are Emacs-normalised before they get to this
    hook,
    ie everything before the slashes is thrown away:
    /home/sgml/x.dtd -> /home/sgml/x.dtd
    file:/home/sgml/x.dtd -> /home/sgml/x.dtd :-)
    file://home/sgml/x.dtd -> /home/sgml/x.dtd :-) but also :-|
    because ...
    http://www.dot.org/x.dtd -> /www.dot.org/x.dtd :-(