Skip to main content.
home | support | download

Back to List Archive

Re: MIME Types of zipped files

From: Lars D. Noodén <lars(at)not-real.umich.edu>
Date: Thu Nov 10 2005 - 17:09:01 GMT
I'm still looking at SWISH::Filter

On Thu, 10 Nov 2005, Bill Moseley wrote:
> You can't have two XML declarations in the file.  Libxml2 will just
> stop parsing.

Would this script below then work?  There is only one XML declaration and 
then contents of the plain text file are wrapped in a wrapper as well. 
If so then I'll try to figure out how to implement it in perl in the 
context of SWISH::Filter

-Lars

 	#!/bin/sh

 	FILE=$1;

 	echo -e  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<wrapper>";

 	(echo "<mimetype>"; unzip -cq $FILE mimetype ; echo "</mimetype>"; ) \
 	 | grep -v '<?xml version="1.0" encoding="UTF-8"?>';

 	unzip -cq $FILE meta.xml \
 	 | grep -v '<?xml version="1.0" encoding="UTF-8"?>';

 	unzip -cq $FILE content.xml \
 	 | grep -v '<?xml version="1.0" encoding="UTF-8"?>';

 	echo "</wrapper>"


Lars Nooden (lars@umich.edu)
 	On the Internet, nobody knows you're a dog ...
 	... until you start barking.
Received on Thu Nov 10 09:09:10 2005