ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject XMLCatalog: use Paths instead of FileSets?
Date Sat, 30 Nov 2002 08:06:39 GMT
Hi,

The XMLCatalog type has recently had support added for external catalog
files, through the addition of nested <catalogfiles> FileSets:

<xmlvalidate ...>
  <xmlcatalog>
    <catalogfiles dir="...">
      <include name="catalog*" />
    </catalogfiles>
  </xmlcatalog>
  ...
</xmlvalidate>

This is fine, but doesn't allow one to list catalogs that _may_ exist.

For example, in Forrest we have a central catalog under $FORREST_HOME,
and then the user may optionally specify their own catalog, listing
project-specific DTDs.  There is no way currently to represent that
optional catalog, because the FileSet throws a BuildException if it
isn't present.

Likewise, many (but not all) Unix systems have a central catalog in
/etc/sgml/catalog.  It would be nice to be able to add this to a
'catalog search path', without risking failure if it isn't present.

Also, many SGML/XML tools (nsgmls, jade, xsltproc, xmllint) use a
SGML_CATALOG_FILES env variable to locate catalogs.  This variable
contains a colon-separated list of catalogs.  I'd like to be able to
use this in Ant.

All this can be achieved if catalogs are specified in path, rather
than a fileset.  There is a strong analogy here with classpaths: just
as a class may be in any jar in a classpath, so a DTD ref may be in
any catalog listed in a catalogpath.

So I propose the introduction of a <catalogpath> nested element.  As a
Path can contain FileSets, <catalogpath> would subsume the
functionality of <catalogfiles>, which would be deprecated.
<catalogpath> would allow stuff like:

<pathelement location="/etc/sgml/catalog"/>

and

<pathelement path="${env.SGML_CATALOG_FILES}"/>

and for Forrest:

<xmlvalidate...>
  <xmlcatalog>
    <catalogpath>
      <pathelement location="${project.schema-dir}/catalog"/>
      <fileset dir="${forrest.home}/context/resources/schema">
        <include name="catalog" />
      </fileset>
    </catalogpath>
  </xmlcatalog>
...

I have this change working locally, but thought I'd bounce the idea on
the list before tidying it up, doing docs, unit tests etc.

I see Jose Alberto is also playing with <xmlcatalog>.  I don't _think_
this intersects, but Cc'ing to make sure..

Any opinions?


--Jeff


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message