GNOME Bugzilla – Bug 790746
Allow xmlcatalog to search in XML_CATALOG_FILES
Last modified: 2017-11-23 04:27:43 UTC
On NixOS, there is no central catalog file, we rely entirely on XML_CATALOG_FILES variable which is populated by dependencies inside the package scope. For example, if a package depends on XHTML 1.0 and SVG 1.1, the variable will be set as follows: $ echo $XML_CATALOG_FILES /nix/store/gpmc5rrkcb5w4624kijqinva2iaqpd3y-xhtml1-20020801/xml/dtd/xhtml1/catalog.xml /nix/store/hcgy8rw0wa20pwrmybqn7lvmzyz1li4s-svg-1.1/share/xml/svg-1.1/catalog.xml Now if we want to check if a schema is available, we need to run the command for every item listed in the variable – we cannot just omit the catalog path: $ xmlcatalog "-//W3C//DTD XHTML 1.0 Strict//EN" Unknown option -//W3C//DTD XHTML 1.0 Strict//EN $ xmlcatalog -- "-//W3C//DTD XHTML 1.0 Strict//EN" Unknown option -- $ xmlcatalog "" "-//W3C//DTD XHTML 1.0 Strict//EN" No entry for PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN It works correctly in the shell, but that is hardly usable from scripts: $ xmlcatalog --shell > public "-//W3C//DTD XHTML 1.0 Strict//EN" /nix/store/gpmc5rrkcb5w4624kijqinva2iaqpd3y-xhtml1-20020801/xml/dtd/xhtml1/xhtml1-strict.dtd Optimally, the command would allow to omit the CATALOGFILE argument but since the entities parameter is variadic, we need to introduce a placeholder or a new option. I propose a --lookup option, that would skip the CATALOGFILE requirement.
Forgot to mention, in the absence of XML_CATALOG_FILES variable, the default /etc/xml/catalog catalog would be searched, as described on the manpage.
I was using libxml 2.9.5, apparently this was fixed in 2.9.7. Good work!