Hi Brian,
if a DTD does not have a public ID (you have to look at the DTD itself, there
may be one eventhough it is not used in the XML), it has just the system one
and then this is immediately the location of the file, how else would you refer
to it? Another thing is a mapping of an URL (which is the system ID in your
XML) to a local copy of the referenced DTD, i.e. to a local URL or filepath.
This is probably what you want to do. But I don't think it is possible to do
this directly in an antfile using XMLCatalog element itself. You will probably
have to use Apache XML-commons resolver with an external catalog file such as
OASIS XML Catalog. Then in your antfile you will use something like:
<xmlcatalog>
<catalogpath>
<pathelement location="xmlcatalog.xml"/>
</catalogpath>
</xmlcatalog>
And in the referenced external file xmlcatalog.xml you will have something like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN"
"oasis-xmlcatalog-1.1.dtd">
<catalog
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system
systemId="http://www.w3.org/2001/XMLSchema.dtd"
uri="w3c-xmlschema-1.0.dtd"/>
</catalog>
Which will then map all requests for the given http:// URL to a local file
w3c-xmlschema-1.0.dtd.
Hope that helps.
David
-----Original Message-----
From: Brian Agnew [mailto:[email protected]]
Sent: Tuesday, August 04, 2009 1:23 PM
To: Ant Users List
Subject: <xmlcatalog> query
Hi -
When using <xmlcatalog> I have to specify the DTD public id, and the
location. Now, if I have an XML with the following DOCTYPE definition
<!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd">
This appears to have no public id (or is it implicit, somehow?). How do
I reference a local copy of the above DTD using <xmlcatalog> ?
Thanks,
Brian
--
Brian Agnew http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]