You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2010/05/26 11:27:11 UTC

svn commit: r948376 - /tika/trunk/tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java

Author: jukka
Date: Wed May 26 09:27:10 2010
New Revision: 948376

URL: http://svn.apache.org/viewvc?rev=948376&view=rev
Log:
TIKA-425: Exception parsing mp3

Fix based on patch by Gerd Bremer

Modified:
    tika/trunk/tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java

Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java?rev=948376&r1=948375&r2=948376&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/sax/XHTMLContentHandler.java Wed May 26 09:27:10 2010
@@ -200,10 +200,20 @@ public class XHTMLContentHandler extends
         ignorableWhitespace(NL, 0, NL.length);
     }
 
+    /**
+     * Emits an XHTML element with the given text content. If the given
+     * text value is null or empty, then the element is not written.
+     *
+     * @param name XHTML element name
+     * @param value element value, possibly <code>null</code>
+     * @throws SAXException if the content element could not be written
+     */
     public void element(String name, String value) throws SAXException {
-        startElement(name);
-        characters(value);
-        endElement(name);
+        if (value != null && value.length() > 0) {
+            startElement(name);
+            characters(value);
+            endElement(name);
+        }
     }
 
 }