Remote dtd support using e-xml.el in EMacro

  • Marc P. Davignon

    I've been using Emacs for a number of years now, however I'm still new to the Lisp syntax. I've been using psgml-1.2.5 and html-helper-mode-3.0.4 to color format sgml, xml, and html files and have always wanted external dtd definitions to work:

    Example: Including !DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
    ""> in an xml files always produces the error External entity article not found
      Public identifier -//OASIS//DTD DocBook XML V4.2//EN
      System identifier

    I have read both on the EMacro site and else where that using a combination of e-xml.el (2.6.0), w3-4.0.47, and Emacs 20.7 would be able to resolve this issue.

    I have all the versions of the above applications installed on my Linux box but I'll not sure of the dot emacs or ~/emacs/* entries to make all of these things work together.

    Has anyone been able to make the above combinations of applications use remote dtd's successfully and if so how?


    • Bruce Ingalls

      Bruce Ingalls - 2003-06-12

      I added an answer to this in TIPS on the web, and soon to be part of EMacro docs.

      • Bruce Ingalls

        Bruce Ingalls - 2003-06-12

        EMacro includes a test.xml file in the contrib directory, for testing remote DTD support

    • Marc P. Davignon

      Your tips help in that I believe I did the right thing getting Emacro installed but when I open ~/emacs/contrib/test.xml I still get the error:

      External entity test not found
        System identifier

      Here is a snip-it of my *Messages* output:

      Loading url-auth...
      Loading url-auth...done
      Loading url-http...
      Loading url-http...done
      Loading url-cache...
      Loading url-cache...done
      Loading url-gw...
      Loading url-gw...done
      Retrieval complete.
      Mark set
      External entity test not found
        System identifier
      Loading psgml-dtd...
      Loading psgml-dtd...done
      Parsing doctype (1 elements)...
      Parsing doctype...done
      Parsing prolog...done

      Fontifying test.xml...
      Fontifying test.xml... (syntactically...)
      Loading lazy-lock...
      Loading lazy-lock...done
      Fontifying test.xml...
      Fontifying test.xml... (syntactically...)
      Loading lazy-lock...done

      It looks like I'm connecting OK and even retrieving the dtd, but it looks like I'm not parsing it correctly.

      Any ideas? If I do a "which nsgmls" it returns /usr/bin/nsgmls, so I think my PATH is OK.

      • Bruce Ingalls

        Bruce Ingalls - 2003-06-13

        Argh! It looks that psgml.el has removed

        I wrote a message to the author of psgml.
        In the mean time, you can:
        1) Download the dtd, and reference it locally.
        You may have to change e-xml.el line 357
        ;;(set-default 'sgml-system-identifiers-are-preferred 'nil)
        so that nil is the default (could also be by commenting, as above)
        2) Search emacs-wiki from the EMacro home page, for "xml". I hope to add the simpler, less powerful xml option to a future EMacro release.
        3) Get an older version of psgml.el

    • Marc P. Davignon

      > 1) Download the dtd, and reference it locally.

      I'd rather not do this because it negates the whole point of using e-xml.el in the first place (for me).

      >3) Get an older version of psgml.el

      I went back and installed versions 1.2.0 - 1.2.5 and they all resulted in the same error. (1.2.0 had other xml errors).

      I also grepped the psgml el source and found the sgml-sysid-resolve-functions() in the same place in each version: - Variable: sgml-sysid-resolve-functions
      psgml-api.texi:@defvar sgml-sysid-resolve-functions
      psgml-parse.el:(defvar sgml-sysid-resolve-functions nil
      psgml-parse.el:     (loop for fn in sgml-sysid-resolve-functions
      psgml-parse.el:               (loop for fn in sgml-sysid-resolve-functions
      psgml.texi:@c *** sgml-sysid-resolve-functions

      Looks like psgml-parse.el contains this function not psgml.el.

      Any other ideas?

      • Bruce Ingalls

        Bruce Ingalls - 2003-06-13

        Hm. I've not used EMacro for XML parsing for some time.
        Except for the warning message, it seems to be doing the right thing.
        What is going wrong, when you edit your XML?
        Perhaps I need a more sophisticated test.dtd and test.xml.
        Send me a sample xml & dtd.

        Are you familar with xml schemas, which are supposed to replace DTDs? Do we need another strategy for those?

    • Marc P. Davignon

      > Except for the warning message, it seems to be doing the right thing.

      True, but the error message is what bothered me in the first place, since it would use half the screen.

      Here is an example of a remote xml DTD I use commonly:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "";>

      > Are you familiar with xml schemas, which are supposed to replace DTDs?

      Yes, but currently I've been writing or updating a large number of DocBook and existing html documents and have no plans to switch to xml schemas in the near future.

      I gave this product a try because it could open remote DTDs and hopefully stop returning errors which did not happen.

      If you think this can be fixed let me know, otherwise I'll create a work around in another product I've been using.

    • Bruce Ingalls

      Bruce Ingalls - 2003-07-06

      The warning window is due to psgml code. All I can do in EMacro, is mask the error, with a condition-case().
      This is not a good solution.
      The best solution, is to solve the problem in one of the psgml files.
      I contacted the maintainer, but have gotten no reply.
      Feel free to send him my patch, or try getting the psgml maintainer to respond.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks