You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ma...@apache.org on 2007/09/27 19:31:52 UTC

svn commit: r580110 - in /incubator/tika/trunk: CHANGES.txt src/main/java/org/apache/tika/parser/Parser.java

Author: mattmann
Date: Thu Sep 27 10:31:51 2007
New Revision: 580110

URL: http://svn.apache.org/viewvc?rev=580110&view=rev
Log:
- fix for TIKA-36

Modified:
    incubator/tika/trunk/CHANGES.txt
    incubator/tika/trunk/src/main/java/org/apache/tika/parser/Parser.java

Modified: incubator/tika/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/tika/trunk/CHANGES.txt?rev=580110&r1=580109&r2=580110&view=diff
==============================================================================
--- incubator/tika/trunk/CHANGES.txt (original)
+++ incubator/tika/trunk/CHANGES.txt Thu Sep 27 10:31:51 2007
@@ -49,3 +49,7 @@
 
 23. TIKA-31 - protected Parser.parse(InputStream stream,
               Iterable<Content> contents) (jukka & K. Bennett)
+              
+24. TIKA-36 A convenience method for getting a document's content's text 
+              would be helpful (K. Bennett & mattmann)
+  

Modified: incubator/tika/trunk/src/main/java/org/apache/tika/parser/Parser.java
URL: http://svn.apache.org/viewvc/incubator/tika/trunk/src/main/java/org/apache/tika/parser/Parser.java?rev=580110&r1=580109&r2=580110&view=diff
==============================================================================
--- incubator/tika/trunk/src/main/java/org/apache/tika/parser/Parser.java (original)
+++ incubator/tika/trunk/src/main/java/org/apache/tika/parser/Parser.java Thu Sep 27 10:31:51 2007
@@ -90,6 +90,21 @@
     }
 
     /**
+     * Returns the text associated with the Content named 'name',
+     * or null if such a Content does not exist.
+     *
+     * @param name name of Content the caller wants the value of
+     * @return the found Content's value, or null if not found
+     */
+    public String getContentValue(String name) {
+        Content content = getContent(name);
+
+        return content != null
+                ? content.getValue()
+                : null;
+    }
+
+    /**
      * Get a List of contents objects, this objects are configured from the
      * TikaConfig Xml file. It could be a document metadata, XPath selection,
      * regex selection or fulltext