Author: jukka
Date: Tue Feb 3 23:43:04 2009
New Revision: 740516
URL: http://svn.apache.org/viewvc?rev=740516&view=rev
Log:
TIKA-192: Add glob and magic patterns for image types
Added CGM and SVG type information.
Added:
lucene/tika/trunk/src/test/resources/test-documents/testSVG.svg
Modified:
lucene/tika/trunk/src/main/resources/mime/tika-mimetypes.xml
lucene/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
Modified: lucene/tika/trunk/src/main/resources/mime/tika-mimetypes.xml
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/src/main/resources/mime/tika-mimetypes.xml?rev=740516&r1=740515&r2=740516&view=diff
==============================================================================
--- lucene/tika/trunk/src/main/resources/mime/tika-mimetypes.xml (original)
+++ lucene/tika/trunk/src/main/resources/mime/tika-mimetypes.xml Tue Feb 3
23:43:04 2009
@@ -102,7 +102,6 @@
<glob pattern="*.roles" />
<glob pattern="*.sh" />
<glob pattern="*.sql" />
- <glob pattern="*.svg" />
<glob pattern="*.tld" />
<glob pattern="*.types" />
<glob pattern="*.vm" />
@@ -541,6 +540,14 @@
<glob pattern="*.xml" />
</mime-type>
+ <mime-type type="image/svg+xml">
+ <sub-class-of type="application/xml" />
+ <acronym>SVG</acronym>
+ <comment>Scalable Vector Graphics</comment>
+ <root-XML localName="svg" namespaceURI="http://www.w3.org/2000/svg" />
+ <glob pattern="*.svg" />
+ </mime-type>
+
<mime-type type="application/x-mif">
<magic priority="50">
<match value="\<MakerFile" type="string" offset="0" />
@@ -1079,6 +1086,16 @@
<glob pattern="*.ppm" />
</mime-type>
+ <mime-type type="image/cgm">
+ <acronym>CGM</acronym>
+ <comment>Computer Graphics Metafile</comment>
+ <magic priority="50">
+ <match value="BEGMF" type="string" offset="0" />
+ <match value="0x0020" mask="0xffe0" type="string" offset="0" />
+ </magic>
+ <glob pattern="*.cgm" />
+ </mime-type>
+
<mime-type type="image/x-tika-dng">
<acronym>DNG</acronym>
<comment>Adobe Digital Negative</comment>
Modified:
lucene/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java?rev=740516&r1=740515&r2=740516&view=diff
==============================================================================
--- lucene/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java
(original)
+++ lucene/tika/trunk/src/test/java/org/apache/tika/mime/TestMimeTypes.java Tue
Feb 3 23:43:04 2009
@@ -153,6 +153,19 @@
assertTypeByName("image/x-portable-pixmap", "x.PPM");
}
+ public void testCgmDetection() throws Exception {
+ // TODO: Need a test image file
+ assertTypeByName("image/cgm", "x.cgm");
+ assertTypeByName("image/cgm", "x.CGM");
+ }
+
+ public void testSvgDetection() throws Exception {
+ assertType("image/svg+xml", "testSVG.svg");
+ assertTypeByData("image/svg+xml", "testSVG.svg");
+ assertTypeByName("image/svg+xml", "x.svg");
+ assertTypeByName("image/svg+xml", "x.SVG");
+ }
+
public void testRawDetection() throws Exception {
assertTypeByName("image/x-tika-dng", "x.dng");
assertTypeByName("image/x-tika-dng", "x.DNG");
Added: lucene/tika/trunk/src/test/resources/test-documents/testSVG.svg
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/src/test/resources/test-documents/testSVG.svg?rev=740516&view=auto
==============================================================================
--- lucene/tika/trunk/src/test/resources/test-documents/testSVG.svg (added)
+++ lucene/tika/trunk/src/test/resources/test-documents/testSVG.svg Tue Feb 3
23:43:04 2009
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="1cm" height="1cm" version="1.1" xmlns="http://www.w3.org/2000/svg">
+ <rect x="0.1cm" y="0.1cm" width="0.8cm" height="0.8cm"/>
+</svg>
\ No newline at end of file