Subject: | Support OASIS XML Catalogs [patch] |
John Cowan's XML Catalog is long gone and it would be really handy to support Oasis XML catalogs.
Attached is a rudimentary patch to achieve this. I've just got this working and it needs a tidy up, but I thought I'd kick of the discussion before I get much further.
I didn't remove any of the support for John's catalogs because I thought it might still be being used somewhere :)
I'm happy to be a co-maintainer if you don't have time or desire to do this. PAUSE ID is JFEARN.
And here is a sample run:
$ perl -e 'use XML::Catalog; \
$pubid = q|-//OASIS//DTD DocBook XML V4.5//EN|; \
my $catalog=XML::Catalog->new("/etc/xml/catalog"); \
print $catalog->resolve_public($pubid), "\n";'
file:///usr/share/sgml/docbook/xml-dtd-4.5-1.0-51.el6/docbookx.dtd
Cheers, Jeff.
Subject: | oasis.patch |
diff -ur XML-Catalog-0.02/Catalog.pm XML-Catalog-0.02-oasis/Catalog.pm
--- XML-Catalog-0.02/Catalog.pm 2000-09-22 00:07:52.000000000 +1000
+++ XML-Catalog-0.02-oasis/Catalog.pm 2013-07-18 14:52:44.666934372 +1000
@@ -274,6 +274,48 @@
$self->set_base($attrs{HRef});
}
+sub catalog {
+}
+sub rewriteURI {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_delegate($attrs{uriStartString},$attrs{rewritePrefix});
+}
+sub rewriteSystem {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_delegate($attrs{systemIdStartString},$attrs{rewritePrefix});
+}
+
+sub public {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_map($attrs{publicId},$attrs{uri});
+}
+
+sub delegatePublic {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_extend($attrs{catalog});
+}
+
+sub delegateSystem {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_extend($attrs{catalog});
+}
+
+sub delegateURI {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_extend($attrs{catalog});
+}
+
+sub system {
+ my ($p,$elem,%attrs)=@_;
+ my $self=$p->{XMLCatalog};
+ $self->add_delegate($attrs{systemId},$attrs{uri});
+}
1;
__END__