From: Henrik Motakef <henrik.motakef@web.de>
Subject: Re: Why won't PSGML use http system identifiers?
Date: 29 Oct 2002 21:03:06 +0100 [thread overview]
Message-ID: <87smyp8139.fsf@pokey.henrik-motakef.de> (raw)
In-Reply-To: JjBv9.288$dz2.49188@stones
"D. D. Brierton" <darren@dzr-web.com> writes:
> Is there some reason why PSGML has to have all the various DTDs, mod and ent
> files on the local system, as opposed to downloading them via http when the
> system identifier is a URL?
Probably because there isn't a portable way to download something via
HTTP, AFAIK.
Here's a workaround I use. It depends on the Url lib from
<http://www.gnu.org/software/url/>. It is probably a quite stupid way
to do this, but it seems to work for me so far.
(require 'url)
(defun download-uri-to-string (uri)
(let* ((buffer (url-retrieve-synchronously uri))
(data (with-current-buffer buffer
(goto-char (point-min))
(forward-paragraph)
(buffer-substring (point) (point-max)))))
(kill-buffer buffer)
data))
(defun my-insert-sysid (sysid)
(condition-case nil
(progn (insert (download-uri-to-string sysid)) t)
(error ; Couldn't download, maybe uri is relative?
(let ((last-uri
(second (third (caar (sgml-entity-text sgml-current-eref))))))
(condition-case nil
(progn
(insert
(download-uri-to-string
(concat (file-name-directory last-uri) sysid)))
t)
(error nil))))))
(add-to-list 'sgml-sysid-resolve-functions 'my-insert-sysid)
Would be nice if someone could look at it, and perhaps explain what
I'm doing, esp. in the `(second (third (caar ...' line. If have no
idea if there is some "official" API for the eref structure, or this
code will work with other PSGML versions.
> Basically, I'm trying to set up PSGML mode for XHTML 1.1 and frankly getting
> hold of all the various modules is a complete nightmare, and I'm especially
> concerned that it will prove hard to keep up-to-date.
I wouldn't expect any major changes in XHTML 1.1 to come :-)
Regards
Henrik
next prev parent reply other threads:[~2002-10-29 20:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-29 19:28 Why won't PSGML use http system identifiers? D. D. Brierton
2002-10-29 20:03 ` Henrik Motakef [this message]
2002-10-30 8:06 ` Arto V. Viitanen
2002-10-30 10:13 ` Puff Addison
2002-10-30 20:31 ` Henrik Motakef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87smyp8139.fsf@pokey.henrik-motakef.de \
--to=henrik.motakef@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).