Install the HTML DTDs

  1. Access the DTDs via the menu

    PSGML allows to insert the document type declaration via menu commands. To this end, all DTDs that you want to use this way have to be added to a variable in your _emacs. Insert the following lines into your configuration file:

         
    ;; PSGML menus for creating new documents
    (setq sgml-custom-dtd
    '(
      ( "HTML 2.0"
        "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">")
      ( "HTML 2.0 Strict"
        "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0 Strict//EN\">")
      ( "HTML 2.0 Level 1"
        "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0 Strict Level 1//EN\">")
      ( "HTML 3.2 Final"
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">")
      ( "HTML 4"
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">")
      ( "HTML 4 Frameset"
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\">")
      ( "HTML 4 Transitional"
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">")
      ( "DocBook 4.1"
       "<!DOCTYPE Book PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\">")
      )
    )
          
       
    

    Strictly speaking, the last entry does not yet belong here, but we will need it when we install the DocBook DTD. Just keep in mind that we inserted these lines already at this point.

  2. Create the directory structure

    Having all DTDs in a separate directory tree simplifies the maintenance greatly. Therefore create a new \sgml\dtd subdirectory in a directory which has read access for all users on your system, e.g. C:\user\default. This will be the root directory of all DTDs.

  3. Copy the files

    Create a subdirectory html and copy all relevant files (html*.*, isolat1.*, and xml.*) from the OpenJade-1.3\pubtext installation directory into your new html subdirectory.

  4. Create the catalog file

    Open a new catalog file in the same directory using Emacs, e.g. by typing C-x C-f c:/user/default/sgml/dtd/html/catalog [RETURN]. Insert the following lines:

         
    OVERRIDE YES
    
    PUBLIC "-//IETF//DTD HTML 2.0//EN" "html.dtd"
    PUBLIC "-//IETF//DTD HTML 2.0 Strict//EN" "html-s.dtd"
    PUBLIC "-//IETF//DTD HTML 2.0 Level 1//EN" "html-1.dtd"
    PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN" "html-1s.dtd"
    PUBLIC "-//W3C//DTD HTML 3.2 Final//EN" "HTML32.dtd"
    PUBLIC "-//W3C//DTD HTML 4.0//EN" "HTML4-s.dtd"
    PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "HTML4.dtd"
    PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "HTML4-f.dtd"
    PUBLIC "-//W3C//ENTITIES Latin1//EN//HTML" "HTMLlat1.ent"
    PUBLIC "-//W3C//ENTITIES Special//EN//HTML" "HTMLspec.ent"
    PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" "HTMLsym.ent"
          
       
    

    The first line tells a catalog-using application that the public identifier should override any system identifier. The HTML4 DTDs use URLs as system identifiers for the entity files and thus would need an internet connection whenever you validate them, but with this little trick they will be just as happy with the local copies.

    As the DTD and entity files are in the same directory as the catalog file, a path is not necessary. However, if you want to use a single catalog file for all your DTDs and put it e.g. into the \sgml\dtd directory, you would have to specify the filenames as e.g. /html/html.dtd. In the following procedures I assume that you use several catalog files to simplify the descriptions.

  5. Register the catalog file

    Add the full path of your new catalog file, e.g. C:\user\default\sgml\dtd\html\catalog, to the semicolon-separated list of your environment variable SGML_CATALOG_FILES. Use the procedure as described previously.

  6. Create your ecatalog file

    Create a new file called ecatalog in the same directory as the previous catalog file, e.g. by typing C-x C-f C:/user/default/sgml/dtd/html/ecatalog [RETURN] in your Emacs. Enter the following lines into this new file:

         
    PUBLIC "-//IETF//DTD HTML 2.0//EN" "html.ced"
    PUBLIC "-//IETF//DTD HTML 2.0 Strict//EN" "html-s.ced"
    PUBLIC "-//IETF//DTD HTML 2.0 Level 1//EN" "html-1.ced"
    PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN" "html-1s.ced"
    PUBLIC "-//W3C//DTD HTML 3.2 Final//EN" "HTML32.ced"
    PUBLIC "-//W3C//DTD HTML 4.0//EN" "HTML4-s.ced"
    PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "HTML4.ced"
    PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "HTML4-f.ced"
          
       
    
  7. Register your ecatalog file

    Put the following lines into your _emacs:

         
    ;; ecat support
    (setq sgml-ecat-files
      (list
        (expand-file-name "c:/user/default/sgml/dtd/html/ecatalog")
        (expand-file-name "c:/user/default/sgml/dtd/docbook41/ecatalog")
    ))
          
       
    

    Again, the last line is not related to the HTML DTDs, but we will need it later. Restart your Emacs to let the changes in _emacs take effect.

  8. Parse the DTDs

    To test-drive the new setup, create a new file in your Emacs with the extension .html, e.g. by typing C-x C-f c:/user/myself/test.html. This should load PSGML automatically. Now use e.g. the DTD->Insert DTD->HTML 4 menu command to insert the document type declaration into your test document. PSGML should automatically start to parse the DTD (if not, use the DTD->Parse DTD menu command or simply press C-c C-p). As PSGML finds a corresponding entry in the registered ecatalog file but no parsed DTD, it will automatically save the DTD as HTML4s.ced in the \html subdirectory.

    If this test was successful, all other parsed DTDs will be generated on the fly whenever you use a registered DTD for the first time.

    Note: On Windows NT/2000/XP, it may be necessary to create the compiled DTDs with administrator rights (this depends on the access rights of the directories that contain the DTD files). If this is the case on your system, you should repeat the above procedure for all installed DTDs from your administrator account.

  9. Set the SGML declaration

    Open your _emacs file and locate the function declaration:

    (defun sgml-html-mode()
       
    

    Within this function, locate the line:

         sgml-declaration          "d:/user/default/sgml/dtd/html/html4.dcl"
       
    

    Adjust the path to your local system.

    Note: We just set a reasonable default value in _emacs. The declaration you enter here should match the HTML DTD that you will use most of the time. If it should be the case that you mainly use e.g. the HTML3.2 DTD, you would rather specify html32.dcl here. Whenever you need a different declaration than the default, use the menu command SGML->User options->Declaration to set a new value.