I'm confused about how xmlcatalogs work. I can't seem to get it to find
local DTDs at all, either from files or from jars in the classpath (when
using the commented out <dtd> element). The items in the catalog are found
correctly (so the public IDs are set correctly), but I can't get it to find
the DTDs referenced in the location. The parser will subsequently find the
DTD at its defined SYSTEM URL path from the DOCTYPE in the XML file, but it
doesn't appear to find it via the xmlcatalog.

I've tried paths and locations in the xmlcatalog's classpath element. I've
tried adding "./". Unfortunately, -debug doesn't tell you anything about any
paths, but I can't see anything wrong with what I currently have defined.

I have both the jar file and the DTD file (extracted from the jar file) in
the same directory as the build.xml file, as well as the struts-config.xml
I'm trying to validate. I tried to simplify it down as much as possible.

What am I doing wrong?

Thanks!
Jason


ant 1.5, Sun JDK 1.3.1_04, using the default Xerces parser, default
CLASSPATH is empty

build.xml:
<project name="xmlTest" default="validateXML" basedir=".">
    <target name="validateXML">
        <xmlvalidate lenient="no" failonerror="no">
            <fileset dir=".">
                <include name="struts-config.xml" />
            </fileset>
            <xmlcatalog refid="allDTDs" />
        </xmlvalidate>
    </target>

    <xmlcatalog id="allDTDs">
        <classpath>
            <pathelement location="." />
            <pathelement location="struts.jar" />
        </classpath>
<!--         <dtd
            publicId="-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
            location="org/apache/struts/resources/struts-config_1_1.dtd"/>
-->
        <dtd
            publicId="-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
            location="struts-config_1_1.dtd"/>
    </xmlcatalog>
</project>


command line:

$ ant -debug

Apache Ant version 1.5 compiled on July 9 2002
Buildfile: build.xml
Detected Java version: 1.3 in: d:\pkg\jdk1.3.1_04\jre
Detected OS: Windows 2000

[extraneous user task messages deleted...]

Project base dir set to: D:\anttest
 +Target: validateXML
   +Task: xmlvalidate
   +DataType: xmlcatalog
Adding reference: allDTDs -> org.apache.tools.ant.types.XMLCatalog@189f84
Build sequence for target `validateXML' is [validateXML]
Complete build sequence is [validateXML]

validateXML:
[xmlvalidate] Using SAX2 reader org.apache.xerces.parsers.SAXParser
fileset: Setup scanner in dir D:\anttest with patternSet{ includes:
[struts-config.xml] excludes: [] }
[xmlvalidate] Validating struts-config.xml...
resolveEntity: '-//Apache Software Foundation//DTD Struts Configuration
1.1//EN': 'http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd'
Matching catalog entry found for publicId: '-//Apache Software
Foundation//DTD Struts Configuration 1.1//EN' location:
'struts-config_1_1.dtd'
Couldn't load ResourceStream for struts-config_1_1.dtd
No matching catalog entry found, parser will use:
'http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd'
[xmlvalidate] 1 file(s) have been successfully validated.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to