[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: sup
From: |
Stefan Monnier |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> - 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
- Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Graham Hannington, 2016/03/15
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?,
Stefan Monnier <=
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Graham Hannington, 2016/03/16
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Stefan Monnier, 2016/03/16
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Graham Hannington, 2016/03/16
- Message not available
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Graham Hannington, 2016/03/17
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Stefan Monnier, 2016/03/17
- On-the-fly validation of (X)HTML5 using the v.Nu REST API, Graham Hannington, 2016/03/31
- Re: On-the-fly validation of (X)HTML5 using the v.Nu REST API, Emanuel Berg, 2016/03/31
- Re: On-the-fly validation of (X)HTML5 using the v.Nu REST API, Stefan Monnier, 2016/03/31
- Re: On-the-fly validation of (X)HTML5 using the v.Nu REST API, Emanuel Berg, 2016/03/31
- Re: Using Emacs nXML mode to validate XHTML5 using the v.Nu schemas: support for HTTP-based schema URI?, Graham Hannington, 2016/03/16