cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonid Geller" <>
Subject RE: File Generator and Compressed XML
Date Mon, 12 Mar 2007 14:52:09 GMT
I got to the bottom of the issue.

It's at least two-fold:

1. Bug in org.apache.cocoon.components.source.impl.ZipSourceFactory, on this line:
        // Get protocol. Protocol is configurable via cocoon.xconf
        final String protocol = location.substring(0, protocolEnd - 1);

Obviously it should be location.substring(0, protocolEnd). This is what causes zip to be truncated
to "zi".

2. When using a SYSTEM identifier with relative DTD path, the XML parser will look for the
file relative to the URI of the zipped source,!/source.xml which is obviously
going to fail.

Here, the solution is to have the source implementation class (in this case org.apache.cocoon.components.source.impl.ZipSource)
to change getURI method to return source.xml based on location, w/o the zip protocol.
Current implementation:

	return this.protocol + this.archive.getURI() + "!/" + this.filePath;

is not going to work. Something like this will:

    	int iZipIdx = this.archive.getURI().lastIndexOf("/");
	if (iZipIdx < 0) iZipIdx = 0;
    	return this.archive.getURI().substring(0,iZipIdx)+"/"+ this.filePath;

As I do not have a JIRA account, please feel free to confirm my findings and enter the bug
into the system. 

Thanks for all your help! 

Leonid Geller

-----Original Message-----
From: Grzegorz Kossakowski [] 
Sent: Saturday, March 10, 2007 12:21 PM
Subject: Re: File Generator and Compressed XML

Leonid Geller napisaƂ(a):
> I finally found the problem:
> The zip source works on XML which does not declare a DTD.
> The error ( unknown protocol: zifile) is only reported
when using a doctype (fails with both relative and absolute URLs).
> Any suggestions?

Only suggestion here is to take debugging session. It really must be
some obscure, little bug. Let me know if you are going to track the
problem down. I could have a look into this problem in a week.

Also create an issue on JIRA, please.

Grzegorz Kossakowski

To unsubscribe, e-mail:
For additional commands, e-mail:

This email has been scanned by the MessageLabs Email Security System.
For more information please visit 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message