You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xml-commons-dev@xerces.apache.org by Harald Hett <h....@gis-systemhaus.de> on 2002/05/14 12:26:30 UTC

CatalogResolver with crimson

Hi!

Has anyone used the crimson parser (1.1.3)  together with the Norman 
Walsh's CatalogResolver from xml-commons?
I have written a simple Java-Program, that validates an xml file:

...
	SAXParserFactory factory = SAXParserFactory.newInstance();
	factory.setValidating(true);
	factory.setNamespaceAware(true);
	SAXParser parser = factory.newSAXParser();

	System.out.println("setting CatalogResolver");
	CatalogResolver cr = new CatalogResolver();
	parser.getXMLReader().setEntityResolver(cr);

	System.out.println("parser class is " + parser.getClass().getName());
	System.out.println("entity resolver class is " + parser.getXMLReader().getEntityResolver().getClass().getName());
	parser.parse("c:/temp/test.xml", new MyHandler());
...

But all I get is a fatal error:

setting CatalogResolver
Parse catalog: http://jet.ibfs.de/dtd/catalog.xml
Loading catalog: http://jet.ibfs.de/dtd/catalog.xml
Default BASE: http://jet.ibfs.de/dtd/catalog.xml
system: metamodel.dtd
        http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
SYSTEM: metamodel.dtd
        http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
system: urn:gis-xml:metamodel.dtd
        http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
SYSTEM: urn:gis-xml:metamodel.dtd
        http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
public: -//GIS//DTD XML MetaModel V1.0//EN
        http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
PUBLIC: -//GIS//DTD XML MetaModel V1.0//EN
        http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
parser class is org.apache.crimson.jaxp.SAXParserImpl
entity resolver class is org.apache.xml.resolver.tools.CatalogResolver
FATAL:3:-1:External entity not found: "file:/c:/temp/metamodel.dtd".

The xml file lies in c:/temp and starts as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE metamodel PUBLIC "-//GIS//DTD XML MetaModel V1.0//EN" "metamodel.dtd">
<metamodel version="1.0">
...

Thanks in advance for any hints!

-- 
Harald Hett <h....@gis-systemhaus.de>
Gesellschaft für integrierte Systemplanung



Re: CatalogResolver with crimson

Posted by Norman Walsh <nd...@nwalsh.com>.
/ Harald Hett <h....@gis-systemhaus.de> was heard to say:
| Norman Walsh wrote:
|
|>Can you set the debug value (Debug.setDebug()) to something high (like 10)
|>and send another trace. I'd like to see what comparisons are attempted by
|>the resolver.
|>
| The example was already done with a debug level of 99, but as I
| mentioned in my  email before, the CatalogResolver is never called due
| to an error/feature in the class SAXParser.

Hmm. That wasn't clear (to me) from your last message. I can't see why the
entity resolver isn't getting called.

Have you tried using one of the parsers in org.apache.xml.resolver.apps?

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@Sun.COM   | One does what one is; one becomes what one
XML Standards Engineer | does.--Robert Musil
XML Technology Center  | 
Sun Microsystems, Inc. | 

Re: CatalogResolver with crimson

Posted by Harald Hett <h....@gis-systemhaus.de>.
Norman Walsh wrote:

>Can you set the debug value (Debug.setDebug()) to something high (like 10)
>and send another trace. I'd like to see what comparisons are attempted by
>the resolver.
>
The example was already done with a debug level of 99, but as I 
mentioned in my  email before, the CatalogResolver is never called due 
to an error/feature in the class SAXParser.

Bye

-- 
Harald Hett <h....@gis-systemhaus.de>
Gesellschaft für integrierte Systemplanung




Re: CatalogResolver with crimson

Posted by Norman Walsh <nd...@nwalsh.com>.
/ Harald Hett <h....@gis-systemhaus.de> was heard to say:
[...]
| But all I get is a fatal error:
|
| setting CatalogResolver
| Parse catalog: http://jet.ibfs.de/dtd/catalog.xml
| Loading catalog: http://jet.ibfs.de/dtd/catalog.xml
| Default BASE: http://jet.ibfs.de/dtd/catalog.xml
| system: metamodel.dtd
|         http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
| SYSTEM: metamodel.dtd
|         http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd

It's a bug in SAX (IMnsHO) that you can't do this. The problem is that
the system identifier is always made absolute before it's passed to
the resolver.

| system: urn:gis-xml:metamodel.dtd
|         http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
| SYSTEM: urn:gis-xml:metamodel.dtd
|         http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
| public: -//GIS//DTD XML MetaModel V1.0//EN
|         http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
| PUBLIC: -//GIS//DTD XML MetaModel V1.0//EN
|         http://jet.ibfs.de/dtd/openframe/metamodel/metamodel.dtd
| parser class is org.apache.crimson.jaxp.SAXParserImpl
| entity resolver class is org.apache.xml.resolver.tools.CatalogResolver
| FATAL:3:-1:External entity not found: "file:/c:/temp/metamodel.dtd".

What's more interesting is why this doesn't match on the public identifier.

Can you set the debug value (Debug.setDebug()) to something high (like 10)
and send another trace. I'd like to see what comparisons are attempted by
the resolver.

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@Sun.COM   | And gentlemen in England now a-bed / Shall
XML Standards Engineer | think themselves accursed they were not here,
XML Technology Center  | / And hold their manhoods cheap whiles any
Sun Microsystems, Inc. | speaks / That fought with us upon Saint
                       | Crispin's day.--William Shakespeare, Henry V