From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI? Date: Tue, 15 Mar 2016 10:40:03 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1458052872 19956 80.91.229.3 (15 Mar 2016 14:41:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Mar 2016 14:41:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 15 15:40:58 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1afq9Z-0006IH-17 for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Mar 2016 15:40:57 +0100 Original-Received: from localhost ([::1]:48711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afq9Y-0000x3-H4 for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Mar 2016 10:40:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afq9B-0000wk-JR for help-gnu-emacs@gnu.org; Tue, 15 Mar 2016 10:40:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afq98-00008l-De for help-gnu-emacs@gnu.org; Tue, 15 Mar 2016 10:40:33 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:40205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afq98-00008G-75 for help-gnu-emacs@gnu.org; Tue, 15 Mar 2016 10:40:30 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1afq8w-0005sp-Hw for help-gnu-emacs@gnu.org; Tue, 15 Mar 2016 15:40:23 +0100 Original-Received: from 75-119-244-10.dsl.teksavvy.com ([75.119.244.10]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Mar 2016 15:40:13 +0100 Original-Received: from monnier by 75-119-244-10.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Mar 2016 15:40:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 59 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-119-244-10.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:joSudTStW+DHAUr+1ZEMbh7Ngc0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:109586 Archived-At: > - The GitHub repo hober/html5-el, which provides the datatype library > required by the v.Nu schemas in a Lisp-based format usable by nXML (rather > than, say, a Java-based library usable by Jing) Ha! I put something very similar into GNU ELPA's html5-schema package a month or so ago. >> Invalid URI: "URI `http:/// ... ' does not use the `file:' scheme" > That's okay - it's working, which is great - but I'd prefer to point to > the "live" schemas via HTTP. It might not be too hard to tweak nXML so it accepts HTTP URLs, but I'm not sure what behavior you'd want to see exactly: the naive approach might download all those files via HTTP every time you open an HTML file, slowing down startup significantly. It could also use a cache, but then it begs the question of how often to update the cache. So for my kind of use-case at least, I'd end up preferring to manage the file by hand (i.e. download the files via "git" and update them via "git pull" whenever I feel like it). > I'd appreciate advice on adding support for HTTP URLs to that uri > attribute value (and also include directives in the .rnc files) or, better > still, an update to nXML that includes this support (I'm not a Lisp > programmer, but I could learn). If you enable url-handler-mode, then Emacs will consider "http://..." as a valid file name. So assuming you enabled that mode, you should mostly need to teach nXML to accept those names. E.g. the 100% guaranteed untested patch below might be a good start. Stefan PS: I'd welcome some help to improve the html5-schema so that the HTML it accepts includes SVG elements. diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index 8fc0a01..76f9bc1 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el @@ -82,10 +82,11 @@ rng-uri-file-name-1 (cond ((not scheme) (unless pattern (rng-uri-error "URI `%s' does not have a scheme" uri))) - ((not (string= (downcase scheme) "file")) - (rng-uri-error "URI `%s' does not use the `file:' scheme" uri))) - (when (not (member authority - (cons (system-name) '(nil "" "localhost")))) + ((not (member (downcase scheme) '("file" "http"))) + (rng-uri-error "URI `%s' does not use the `file:' or `http:' scheme" uri))) + (when (and (equal (downcase scheme) "file") + (not (member authority + (cons (system-name) '(nil "" "localhost"))))) (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'" uri)) (when query