[xml] passing the FPI to the DTD validator


Thanks in advance for considering the following wish:

I have a DocBook chapter

<?xml version="1.0" encoding="UTF-8"?>

which is included in the main book via a entity reference:
(this means it can't have a doctype declaration)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book
  PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
 <!ENTITY ch01 SYSTEM "ch01.xml">

While I edit the chapter in Vim I'd like to validate the buffer. I can do it via (shortened)

:%w !xmllint --dtdvalid "/long/path/to/docbookx.dtd" --noout -
[one line]

Works, great. Now I want to add this line to my vimrc (mapped to some keycombo) so that I don't have to type the long line each time. But hardcoding the path to the DTD is not portable; the commandline won't work on the next system (I use the same vimrc on various machines).

So I'd like to pass the FPI to xmllint, and expect it to resolve it as it would do when reading the FPI from a doctype declaration.

Is this already possible? Otherwise perhaps the following would make sense:
(the name of the option is not relevant here)

:%w !xmllint --dtdvalidfpi "-//OASIS//DTD DocBook XML V4.2//EN" --noout -
[one line]

This would work on any system having a catalog which includes the corresponding DTD, the location of the DTD file doesn't matter.

I think there are many cases where it's great that no doctype declaration is required (thus --dtdvalid is a great feature); now I just need this to work with catalogs (something like --dtdvalidfpi).



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]