XML catalog

Artur Frysiak wiget at pld.org.pl
Mon May 27 13:37:45 CEST 2002


On Mon, May 27, 2002 at 01:09:25PM +0200, wrobell wrote:
> On Mon, May 27, 2002 at 12:04:20PM +0200, Artur Frysiak wrote:
> 
> > I looked at docbook-dtd412-xml.spec from -r xmlcatalog. 
> > I think this methodology is not good. 
> > - not registering DTDs for XML documents in SGML SuperCatalog is not
> >   good for openjade/opensp and other SGML apps with XML extensions but
> >   without XML catalogs support.
> Are there any SGML apps with XML extensions which are used at all?
> SGML SuperCatalog needs some dirty hacks to use so I am determined 
> to not support it for XML DTDs.

You may want to use openjade and dsssl stylesheets to convert XML
DocBook 4.1.2 to jadetex/ps/pdf, and you need matching DTD in SGML
SuperCatalog.

> > - direct registering in /etc/xml/catalog is not good for packages
> >   upgrades/removals.
> No. There is no such problem. xmlcatalog can handle catalog entries
> removing.  It is another XML Catalog strength over SGML SuperCatalog.

But look at order of %post/%postun sections:
(very short version)
- new %post
- old %postun

So, all --add's from %post are --del'eted in %postun.
Using --add nextCatalog with %{version}-%{release} fixes this.
Yes, you may protect %post/%postun by if [ $1 == 0 ] but with this you
can handle changes in registration scheme in future.

> 
> > - registering SystemId by rewriteSystem tag is not correct and don't
> >   handle other files from package 
> Please note, that rewrite system is not designed for handling other
> DTDs which are provided by some packages. For example docbook-dtd412-xml
> should register "-//OASIS//DTD XML Exchange Table Model 19990315//EN"
> DTD and others too... it is not finished certainly. It would be nice to
> have a script which could extract and register all DTDs from catalog
> 'docbook.cat' which is provided with docbook packages.

Yes, with simple catalog (one line entries) this script is simple and I
may write it.
 
> Please look at http://xmlsoft.org/catalog.html.
> One of the XML Catalog strengths is the rewrite system.  It is designed
> to replace URI with another one, so for example xml validator will load
> locally installed DTD instead of fetching DTD from net. 
>
> XML Catalog rewrite system gives you ability to put into you document
> following doctype specification
> 
> <!DOCTYPE book "-//OASIS//DTD DocBook XML V4.1.2//EN" 
>     "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
> 
> and use locally installed DTD. This way documents are not tied with
> vendor (PLD, RH, Debian, etc.) specific DTD localization.

Yes, I know this and I suggest using rewriteSystem for "short form"
like this listed by you in next section.

So, for docbook-dtd412-xml.dtd:
%{_bindir}/xmlcatalog --noout --add rewriteSystem \
        http://www.oasis-open.org/docbook/xml/%{ver}/ \
        file://%{_datadir}/sgml/docbook/xml-dtd-%{ver}/ \
		%{catalog}

> > Please look at xhtml-dtd10-xml.spec for my proposal.
> > If you have any questions please ask.
> 
> Following line I would redefine to /etc/xml/catalog:
>   %define catalog %{_datadir}/sgml/html/xml-dtd-%{v_er}/xmlcatalog-%{v_er}-%{version}-%{release}
> and remove this line (/etc/xml/catalog is provided by libxml2 package):
>   xmlcatalog --noout --create $RPM_BUILD_ROOT/%{catalog}
> 
> Will such registered catalog entries:
> 
>   xmlcatalog --noout --add rewriteSystem \
>           'http://www.w3.org/TR/xhtml1/DTD/' \
>           '/usr/share/sgml/html/xml-dtd-%{v_er}/' \
>           $RPM_BUILD_ROOT/%{catalog}
> 
>   xmlcatalog --noout -add public \
>           "-//W3C//DTD XHTML 1.0 Strict//EN" \
>           xhtml1-strict.dtd \
>           $RPM_BUILD_ROOT/%{catalog}
> 
> handle following doctype specification:
> 
>     <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> 
> so DTD will *not* be fetched from Internet?

Yes, DTD will not be fetched from Internet.
If prefer PublicId is true then PublicId from document match registered
PublicId from xml catalog.
If prefer SystemId then rewriteSystem rule is used and local copy of DTD
is used.
I checked this with xmlcatalog --shell.

Regards
-- 
Artur Frysiak
http://www.pld.org.pl/



More information about the pld-devel-en mailing list