unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <jwvk2l37rbv.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: OF610279D9.A7A8BDC6-ON48257F77.001D3013-48257F77.0021D1E9@LocalDomain

> - 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




  reply	other threads:[~2016-03-15 14:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15  6:03 Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI? Graham Hannington
2016-03-15 14:40 ` Stefan Monnier [this message]
2016-03-16  8:45   ` Graham Hannington
2016-03-16 12:27     ` Stefan Monnier
2016-03-16 14:09       ` Graham Hannington
     [not found]         ` <jwv7fh2z5eb.fsf-monnier+emacs@gnu.org>
2016-03-17  9:37           ` Graham Hannington
2016-03-17 12:38             ` Stefan Monnier
2016-03-31  5:37               ` On-the-fly validation of (X)HTML5 using the v.Nu REST API Graham Hannington
2016-03-31 17:54                 ` Emanuel Berg
2016-03-31 18:20                   ` Stefan Monnier
2016-03-31 18:40                     ` Emanuel Berg
2016-04-01  9:22                     ` Graham Hannington
2016-04-01 13:10                       ` Stefan Monnier
2016-04-01 19:13                       ` Emanuel Berg
2016-04-01  4:50                   ` Graham Hannington
2016-04-01 19:08                     ` Emanuel Berg
2016-03-16 14:47     ` Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI? Graham Hannington

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=jwvk2l37rbv.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /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).