Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 87340 invoked from network); 19 Apr 2006 13:18:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Apr 2006 13:18:33 -0000 Received: (qmail 47526 invoked by uid 500); 19 Apr 2006 13:18:12 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 47458 invoked by uid 500); 19 Apr 2006 13:18:11 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 47435 invoked by uid 99); 19 Apr 2006 13:18:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2006 06:18:11 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [134.98.65.18] (HELO gateway.elsag.de) (134.98.65.18) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2006 06:18:10 -0700 Received: from vwall.elsag.de by gateway.elsag.de via smtpd (for asf.osuosl.org [140.211.166.49]) with ESMTP; Wed, 19 Apr 2006 15:17:48 +0200 Received: from esmail ([192.168.2.88]) by vwall-vs.elsag.de with InterScan Messaging Security Suite; Wed, 19 Apr 2006 15:17:46 +0200 Received: from esmail by esmail via smtpd (for vwall.elsag.de [192.168.100.108]) with ESMTP; Wed, 19 Apr 2006 15:17:46 +0200 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: RE: JMimeMagic (was [fileUpload] file content-type) Date: Wed, 19 Apr 2006 15:17:46 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: JMimeMagic (was [fileUpload] file content-type) Thread-Index: AcZjrFcbGW/7S1r+TtG/JIEJCJRnLQAAcvPQ From: =?iso-8859-1?Q?J=F6rg_Schaible?= To: "Jakarta Commons Users List" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Andrea, Andrea Spinelli wrote on Wednesday, April 19, 2006 2:25 PM: > J=F6rg Schaible wrote: >=20 >> Again I am quite sure, that a lot of SVG documents are not >> recognized.=20 >>=20 >> Main problem is that the format specification cannot deal > with variable length. See "man magic" for the format > definition. You cannot express, that a file with an XML > declaration followed by a non-empty line with a DOCTYPE > declaration for SVG is "image/svg+xml". >>=20 >> Bottom line: I am no longer sure, if a mime detection based > on the definitions of file magic is really a good idea :-/ >>=20 >>=20 > Hi everybody! >=20 > I see two mixed problems in the post by Joerg: >=20 > 1. the magic file which is not accurate > 2. the magic file format which is not good enough for XML stylesheets >=20 > 2. facilitates 1. >=20 > I think we should not throw away the great deal of > information present > in the magic file, so we should keep magic.xml, but adding the > possibility of custom matches. >=20 > I propose adding a new test, like > > image/svg+xml > svg > XML SVG > class=3D"com.foo.MyXMLSVGChecher" /> > >=20 > where com.foo.MyXMLSVGChecker implements the interface: >=20 > public interface net.sf.jmimemagic.CustomMatcher { > public boolean match( byte [] sample ); > } > > the function match is passed, according to the above example, at most > 1024 bytes from the file starting at byte 0. >=20 > If the byte sample matches, the function must return true. > Of course, > users of jmimemagic Next Generation must include in their > classpaths the > class MyXMLSVGChecker. 1) It is definitely not possible to built on jmimemagic code because of = licencing reasons 2) Although jMimeMagic claims to use an imported magic file itself, its = magic.xml misses a lot of formats (e.g. tiff), that are present in file = magic since ages 3) Debug it! The code was definately not designed for speed as one would = expect from a utility that should do such examinations on the fly - J=F6rg --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org